问题:当DataGrid已经绑定了数据源,在编辑模式下<asp:TemplateColumn><EditItemTemplate>里面再放了一个DropDrowList控件,这时候无论如何也不能再绑定DropDrowList控件,也就是说我希望在编辑模式下可以做选择而不是填写,敬请高手赐教!

解决方案 »

  1.   

    编辑模式下,先绑定DropDrowList控件
    然后再拖入DataGrid的模版列中。
      

  2.   

    在DataGrid_ItemDataBound()事件中加入一下代码:if (ItemType == ListItemType.Edit)
    {
      DropDownList ddl = (DropDownList)e.Item.FindControl("DropDownList's ID");  BoundDropDownList(ddl); //写一个具体绑定的方法即可
    }private void BoundDropDownList(DropDownList ddl)
    {
       ......;
       ddl.DataSource = "XX";
       ......
       ddl.DataBind();
    }
      

  3.   

    依照 ieooo(Jet) 的方法做,准没错
      

  4.   

    如果你要在dropdownlist里加事件DataGrid_ItemBound里