如何获得GridView单元格的价值 [英] how to get value of gridview cell
本文介绍了如何获得GridView单元格的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在单击编辑"按钮时获取gridview网格状单元格的值.
hi i need get the value of gridview praticular cell when edit button is clicked.
how to do ?
推荐答案
尝试以下操作
Try the below
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
//following will iterate all rows
foreach (GridViewRow row in GridView1.Rows)
{
string value = row.Cells[DesiredcolumnIndex].Text;
}
//following will give the value of single row that is being edited
int i = e.NewEditIndex;
string value = GridView1.Rows[i].Cells[DesiredcolumnIndex].Text;
}
与此相关的内容
GridView.Rows.Cells [i]
i = index
something linke this
GridView.Rows.Cells[i]
i=index
这篇关于如何获得GridView单元格的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文