1 <asp:DetailsView ID="DetailsView1" DataKeyNames="ClassID"
2 runat="server" DataSourceID="SqlDataSource1" AutoGenerateRows="False" >
3 <Fields>
4 <asp:BoundField HeaderText="分类名称" DataField="ClassTitle" />
5 <asp:TemplateField HeaderText="所属分类">
6 <ItemTemplate>
7 <%#Eval("ParentTitle") %>
8 </ItemTemplate>
9 <EditItemTemplate>
10 <asp:DropDownList ID="ddlParent" runat="server" onDataBinding="ddlParent_DataBinding">
11 </asp:DropDownList>
12 </EditItemTemplate>
13 </asp:TemplateField>
14 <asp:CommandField ShowEditButton="True" />
15 </Fields>
16 </asp:DetailsView>
2 runat="server" DataSourceID="SqlDataSource1" AutoGenerateRows="False" >
3 <Fields>
4 <asp:BoundField HeaderText="分类名称" DataField="ClassTitle" />
5 <asp:TemplateField HeaderText="所属分类">
6 <ItemTemplate>
7 <%#Eval("ParentTitle") %>
8 </ItemTemplate>
9 <EditItemTemplate>
10 <asp:DropDownList ID="ddlParent" runat="server" onDataBinding="ddlParent_DataBinding">
11 </asp:DropDownList>
12 </EditItemTemplate>
13 </asp:TemplateField>
14 <asp:CommandField ShowEditButton="True" />
15 </Fields>
16 </asp:DetailsView>
1 protected void ddlParent_DataBinding(object sender, EventArgs e)
2 {
3 //添加数据绑定代码
4 //BindDropDownList((DropDownList)sender);
5 }
2 {
3 //添加数据绑定代码
4 //BindDropDownList((DropDownList)sender);
5 }