如何从gridview单元格中获取字符串值? [英] How do I get string values from my gridview cells?
本文介绍了如何从gridview单元格中获取字符串值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
string strFirstName =(GridView1.DataKeys [e.RowIndex] .Value);
我只想得到我的名字 - >来自我的gridview单元格的列名字符串值。
等待你的回答。
谢谢
解决方案
这就像Wes Aday评论的那样:
GridView1.Rows [rowIndex]。 Cells [cellindex] .Text
或更好:
GridView1.Rows [rowIndex] .Cells [cellindex ] .Value
或者如果你想按名称访问单元格(列):
GridView1。行[rowIndex位置] .Cells [单元名]。价值
string strFirstName = (GridView1.DataKeys[e.RowIndex].Value);
I just want to get my "Firstname"->column name string values from my gridview cells.
waiting for ur ans.
thanks
解决方案
It is like commented by Wes Aday :
GridView1.Rows[rowIndex].Cells[cellindex].Text
or better :
GridView1.Rows[rowIndex].Cells[cellindex].Value
or if you want to Access the cell (column) by name :
GridView1.Rows[rowIndex].Cells[cellname].Value
这篇关于如何从gridview单元格中获取字符串值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文