如图所示:
gridview中单击某行按钮如何得到当前行的textbox中的值?

解决方案 »

  1.   

      //编辑行
        protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            this.GridView1.EditIndex = e.NewEditIndex;
            bind();
        }
    编辑行就可以实现取值功能啊
      

  2.   

    在绑定的时候就把行的索引绑定到按键,当你点按键的是很执行comm方法把索引找出来然后通过索引在去找你需要的值 笨方法
      

  3.   

    rowcommand事件中
    int index = Convert.ToInt32(e.CommandArgument);
    string str=gridview.rows[index].cells[i].text;
      

  4.   

    Textbox tbox_ID=(Textbox)Gridview1.findContral("TextboxID")  
      

  5.   

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Button btn = e.CommandSource as Button;
            Control c = btn.NamingContainer;
            GridViewRow row = c as GridViewRow;
            TextBox textbox = row.FindControl("textboxid") as TextBox;
            string xx = textbox.Text;
            //int index = row.RowIndex;
        }
      

  6.   

    添加一个模板按钮,CommandName为Select
    自定义模板文本框 TextBox tbx1 = (TextBox)gvPlan.SelectedRow.FindControl("tbx1");
    默认grid列:string tbx=GridView.SelectedRow.Cells[i].Text;