本文介绍了无法从 GridView 中的行/单元格获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
限时送ChatGPT账号..我正在尝试使用以下代码从 GridView 获取值:
foreach(this.dgvEstudios.Rows 中的GridViewRow 行){var xy = row.Cells[1].Text;}
总是得到一个空字符串(""
)作为.Text
的返回值,为什么会这样?我已将 EnableViewState
设置为 true
单元格内部可能有控件(例如 LiteralControl 或 HyperLink).这就是您应该寻找的.p>
row.Cells[1].Controls
集合,你应该找一下.
I'm trying get values from a GridView using the following code:
foreach (GridViewRow row in this.dgvEstudios.Rows)
{
var xy = row.Cells[1].Text;
}
Always get a an empty string (""
) as the value returned from .Text
, why does this happen? I have set EnableViewState
to true
The cell might have controls inside it (e.g. LiteralControl or an HyperLink). This is what you should be looking for.
row.Cells[1].Controls
collection, you should look for.
这篇关于无法从 GridView 中的行/单元格获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论