foreach(DataGridItem dgi in Datagrid3.Items)
            {
           TextBox txt = (TextBox)dgi.FindControl("TextBoxID");
               if(txt!=null)
               str=txt.Text.ToString();
   myUserID=dgi.Cells[1].Text.ToString().Trim();
            }

解决方案 »

  1.   

    cell从0开始算的,是不是搞错了?
      

  2.   

    确定你帮定的部分放到了 not ispostback!
      

  3.   

    不知道楼主第二列是个什么列,如果是模版列的话,就不能使用 dgi.Cells[1].Text 来取值了试试用下面的方法:((DataBoundLiteralControl)dgi.Cells[1].Controls[0]).Text;
      

  4.   

    取值的时候你确定再取值之前你的DataGrid没有重新绑定过,也就是你的绑定代码是否放在了
    if(!this.IsPostBack){
    // your bind code ...
    }