<EditItemTemplate>
<asp:DropDownList ID="" DataTextField="Name" DataValueField="ID" Runat="server"></asp:DropDownList>
</EditItemTemplate>

解决方案 »

  1.   


    1——
    对特殊的列使用模板列绑定,从而可以插入DropDownList控件2——
    对DataGrid的ItemDataBound事件增加委托3——
    在ItemDataBound事件委托中,通过e.ItemIndex判断当前行是否DataGrid.EditItemIndex,如果是,则进行下一步4——
    在e.Item中通过ID查找DropDownList,然后再根据当前的数据,为DropDownList进行数据绑定。
      

  2.   

    Html模板列中的Edit控件改成DropDownList后台访问的时候用((DropDownList)e.Item.FindControl("ID")).SelectedValue来获取用户选择的值
      

  3.   

    <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进行数据绑定。
      

  4.   

    问题是我只想在编辑行的这一行生成dropDownlist,其他行不需要,该怎么办?……
      

  5.   

    那可不可以在同一列中既放<EditItemTemplate> 又放<ItemTemplate> ???
      

  6.   

    你定义一个编辑行,在你需要的地方放置DropDownList控件,而其他行则可以放置Label或其它的控件。还是使用我的方法:3——
    在ItemDataBound事件委托中,通过e.ItemIndex判断当前行是否DataGrid.EditItemIndex,如果是,则进行下一步4——
    在e.Item中通过ID查找DropDownList,然后再根据当前的数据,为DropDownList进行数据绑定。
      

  7.   

    支持triout(笨牛)先生的观点!
    楼主要多向triout(笨牛) 先生讨教了!