>>>在没有进入编辑状态前,dropdown是否不能通过e.item.cell[x].controls[x]来访问到?!
不能>>>dorpdwon什么时候开始有效,能通过e.item.cell[x].controls[x]来访问?
in edit mode

解决方案 »

  1.   

    为什么还是不行?System.Web.UI.WebControls.Label gwlabel=(Label)e.Item.Cells[2].FindControl("label3");
    string labeltext=gwlabel.Text;//取得先前label项的text;
    user_list.EditItemIndex=e.Item.ItemIndex;//设置编辑项为被选中项index值
    user_list.DataSource=myDataset.Tables["user_table"];
    user_list.DataBind();//再次绑定,进入编辑状态;
                   
    System.Web.UI.WebControls.DropDownList myDropdown=(DropDownList)e.Item.Cells[2].FindControl("edit_gw");//找到dropdown控件;前面的label取得了,并得到了text的值;
    后面的dropdownlist取不到:
    System.NullReferenceException: 未将对象引用设置到对象的实例。
    哪儿错了?
      

  2.   

    where are you calling
    System.Web.UI.WebControls.DropDownList myDropdown=(DropDownList)e.Item.Cells[2].FindControl("edit_gw");//找到dropdown控件;?? 
    you should be calling inside Update command handler, also, are you sure it is in Cells[2]?
      

  3.   

    label是itemtemplate,dropdown是eidtitemtamplate,同一个tamplatecolumn里的啊,前面的label能取道,
    应该说明“sure it is in Cells[2]”吧?
    我这么想的:进入编辑状态,取得dropdownlist,绑定数据,给用户
    提供一个选择列表。Update就要更新了,那是我要做的下一步,取得dropdown的被选择项。
    显示出来的界面中有dropdownlist控件,是空的。
      

  4.   

    页面的源文件中怎么看不到dropdownlist产生的html?