从gridview获取数据并在文本框中显示

从gridview获取数据并在文本框中显示

问题描述:

im在gridview中有数据,因为我有一个按钮,如果我单击该按钮,则应在文本框中显示该特定ID的数据,以便我们可以在数据库plz中进行编辑和更新.

im having datas in gridview in that i have one button if i click that button the datas of that particular id should be shown in textbox there we can edit and update in database plz help me.


试试这个
hi ,
try this
protected void gh1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
  {
      txt1.Text = gh1.Rows[e.NewSelectedIndex].Cells[2].Text;
  }


最好的问候
米特瓦里(M.Mitwalli)


Best Regards
M.Mitwalli