取出GridView中的值
1.点击“导入”取出图片中红色区域的值
2.双击“导入”进入“查看源码”界面
3.代码如下:
1 protected void btnGo_Click(object sender, EventArgs e)
2 {
3 //获取“CatAttr”所在的行号
4 int index = ((GridViewRow)(sender as Button).Parent.Parent).RowIndex;
5 //根据行号从GridView中取出对应的值
6 string id = this.gvwDB.Rows[index].Cells[0].Text;
7 //输出
8 Response.Write(id.ToString());
9 }
4.查看获取的值