我可以对 datalist 控件的语法使用一些帮助,我在其中的 2 个字段中添加了两个复选框。每个字段都可以在插入或编辑模式下设置。
如何让插入和更新向导读取这些值,而无需在后面的代码中对进程进行自定义编码?
这是ASP..
<asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True"
AutoGenerateRows="False" CellPadding="4" DataKeyNames="keyID"
DataSourceID="SqlDataSource1" Font-Names="Verdana" ForeColor="#333333"
GridLines="Horizontal" Height="50px" Width="340px">
<PagerSettings Mode="NumericFirstLast" Position="TopAndBottom"
PageButtonCount="5" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
<RowStyle BackColor="#EFF3FB" />
<FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" Width="160px" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<Fields>
<asp:BoundField DataField="keyID" HeaderText="keyID" InsertVisible="False"
ReadOnly="True" SortExpression="keyID" />
<asp:BoundField DataField="typeOfDriver" HeaderText="Type Of Driver:"
SortExpression="typeOfDriver" />
<asp:TemplateField HeaderText="Active Type:" SortExpression="activeType">
<EditItemTemplate>
<asp:CheckBox ID="Checkbox1" runat="server" Text='<%# Eval("activeType") %>'></asp:CheckBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:CheckBox ID="Checkbox2" runat="server" Text='<%# Eval("activeType") %>' Checked="True"></asp:CheckBox> True
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("activeType") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Visible in GUI:" SortExpression="visible">
<EditItemTemplate>
<asp:CheckBox ID="Checkbox3" runat="server" Text='<%# Bind("visible") %>'></asp:CheckBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:CheckBox ID="Checkbox4" runat="server" Text='<%# Bind("visible") %>' Checked="True"></asp:CheckBox> True
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("visible") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" ShowInsertButton="True" />
</Fields>
<HeaderStyle BackColor="#99CCFF" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#FFFF99" Width="260px" />
<AlternatingRowStyle BackColor="White" />
</asp:DetailsView>