如何获取gridview的特定单元格值 [英] How to get particular cell value of gridview
本文介绍了如何获取gridview的特定单元格值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在使用gridview,我有1个自动生成的按钮列。
在该按钮中,我有编码电子邮件。
现在我需要提取在gridview的列[4]上的emailid。
那我怎样才能找到价值
ex:
第1行第4列?
现在我的问题是我正在计算行数并正确迭代它/ b $ b但是当我使用Cells [4] .text时我没有得到任何值,而是空白
为什么会这样?
以下是我的代码
foreach (GridViewRow行 in GridView1.Rows)
{
string val = row .Cells [ 4 ]。文字;
Response.Write(val);
}
解决方案
要获取第四列的值,请使用以下语法:
GridView1.Rows [I] .Cells [3]。文本
Hello all,
I am working on gridview and i have 1 autogenerated button column.
In that button i have coding for email.
Now i need to extract emailid which is on say column[4] of gridview.
So How can i retrieve value
for ex:
row 1 column 4 ?
Now my problem is that i am getting row count and iterating throught it properly
but when i am using Cells[4].text i am not getting any values instead it is blank
why is it ?
below is my code
foreach (GridViewRow row in GridView1.Rows)
{
string val = row.Cells[4].Text;
Response.Write(val);
}
解决方案
To get the value of fourth column use the syntax:
GridView1.Rows[i].Cells[3].Text
这篇关于如何获取gridview的特定单元格值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文