我在 gridview控件中  有三列id      号码        签字1       文本框       确定
2       文本框       确定
3       文本框       确定
4       文本框       确定
5       文本框       确定
6       文本框       确定号码列中是一个文本框,需要用户输入内容   签字列是模板 linkbutton按确定。怎么获取文本框中的内容。我的程序必须是在 LinkButton1_Commmand事件中执行的   不能用e.Row.Cells[] 获得谢谢大家了

解决方案 »

  1.   

    this.GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0].Text 
     这样看行么?
      

  2.   

    文本框是自己加入的还是利用GridView中的编辑,如果说是自己加入的得string text=((TextBox)(Gridview1.rows[e.rowindex].cells[指你控件的列数].findcount("TextBox1")).Text.tostring();如果说是编辑则:string text=((TextBox)(Gridview1.rows[e.rowindex].cells[指你控件的列数].counts("TextBox1")).Text.tostring();
      

  3.   

    一定是加上if(!IspostBock)和GridView的主键
      

  4.   

    你把行索引绑定给  CommandArgument 不就行了
      

  5.   

    TextBox tb=Gridview1.rows[e.rowindex].cells[1].findcontrol("TextBox1")as TextBox;
    tb.Text就是你要的值
      

  6.   

    没有Gridview1.rows[e.rowindex]
     
    我是在linkbutton_command事件中,不是在rowdatabound事件中
      

  7.   

    在后台设置一个共有的int型行号row
    public int row=0;protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            Button btn = e.Row.FindControl("Button1") as Button;
            btn.CommandArgument = row.ToString();
            row++;
        }
    这将每行的按钮的CommandArgument赋予一个行号,然后在采用1楼的方法就行了
      

  8.   

    在RowDataBound事件里给你的按钮的CommandArgument直接赋值就行了嘛。