<EditItemTemplate>
<asp:DropDownList ID="" DataTextField="Name" DataValueField="ID" Runat="server"></asp:DropDownList>
</EditItemTemplate>
<asp:DropDownList ID="" DataTextField="Name" DataValueField="ID" Runat="server"></asp:DropDownList>
</EditItemTemplate>
1——
对特殊的列使用模板列绑定,从而可以插入DropDownList控件2——
对DataGrid的ItemDataBound事件增加委托3——
在ItemDataBound事件委托中,通过e.ItemIndex判断当前行是否DataGrid.EditItemIndex,如果是,则进行下一步4——
在e.Item中通过ID查找DropDownList,然后再根据当前的数据,为DropDownList进行数据绑定。
<asp:DropDownList ID="" DataTextField="Name" DataValueField="ID" Runat="server"></asp:DropDownList>
</EditItemTemplate>1.
对特殊的列使用模板列绑定,从而可以插入DropDownList控件2.
对DataGrid的ItemDataBound事件增加委托3.
在ItemDataBound事件委托中,通过e.ItemIndex判断当前行是否DataGrid.EditItemIndex,如果是,则进行下一步4.
在e.Item中通过ID查找DropDownList,然后再根据当前的数据,为DropDownList进行数据绑定。
在ItemDataBound事件委托中,通过e.ItemIndex判断当前行是否DataGrid.EditItemIndex,如果是,则进行下一步4——
在e.Item中通过ID查找DropDownList,然后再根据当前的数据,为DropDownList进行数据绑定。
楼主要多向triout(笨牛) 先生讨教了!