DropDownList dr = (DropDownList)gvr.FindControl("dropdown" + lt.Value.ToString());}
的client名称与你所指定的名称不同。dropdown" + lt.Value.ToString()

解决方案 »

  1.   

    用这种方式来查找(DropDownList)gvr.SelcetRow.cell.Control[0].....
      

  2.   

    protected void gdvMain_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                if (((DropDownList)e.Row.FindControl("drpName")) != null)
                {
                    DropDownList drpName = ((DropDownList)e.Row.FindControl("drpName"));
                    drpName.DataSource = GetDataFromXML("names");
                    drpName.DataBind();
                }
            }
      

  3.   

    把添加控件的代码写在 Page_Load  事件里面。而且不能写在 IsPostBack 里面
      

  4.   

    (DropDownList)gvr.SelcetRow.cell.Control[0].....在那个gvr中根本没有SelcetRow
      

  5.   

    把添加控件的代码写在 Page_Load  事件里面 ,显示出来的GridView有多列空的.
    自动添加<td>&nbsp;</td><td>&nbsp;</td> 这样的列.