DropDownList dp = (DropDownList)e.Item.FindControl("DropDownList1");

解决方案 »

  1.   

    Dim mylb As Label= e.Item.FindControl("Label1")
      

  2.   

    不行,我说了是在EditCommand事件中,你们的方法都是在UpdateCommand事件中的
      

  3.   

    after you rebind the DataGrid, doDataGrid1.DataSource = ....;
    DataGrid1.DataBind();
    DropDownList dp = (DropDownList)DataGrid1.Items[DataGrid1.EditItemIndex].FindControl("DropDownList1");
      

  4.   

    好像还是不行,这是我的代码请saucer(思归) 兄给看看
    private void dgTeam_EditCommand(object source, DataGridCommandEventArgs e)
    {
    dgTeam.EditItemIndex = e.Item.ItemIndex;
    DropDownList selCountry = (DropDownList) dgTeam.Items[dgTeam.EditItemIndex].FindControl("selCountry");
    selCountry.Items.FindByValue(e.Item.Cells[0].Text).Selected = true;
    BindData(); }
      

  5.   

    protected System.Web.UI.WebControls.DropDownList selCountry;定义
      

  6.   

    dgTeam.EditItemIndex = e.Item.ItemIndex;
    //先对dgTeam绑定数据,然后再查找DropDownList
    YourDataBind()
    DropDownList selCountry = (DropDownList) dgTeam.Items[dgTeam.EditItemIndex].FindControl("selCountry");