获取Gridview单元格的标题文本 [英] Get Header Text of Gridview Cell

查看:127
本文介绍了获取Gridview单元格的标题文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的web表单中有一个gridview,我在web表单的Save按钮中使用了下面的代码:

  foreach(GridViewRow row in gvList.Rows)
if(row.RowType == DataControlRowType.DataRow)
{for(int i = 0; i< row.Cells.Count; i ++)
{
string headerRowText = ???;

如何获取当前单元格的标题文本。



 字符串headerRowText = gvList.HeaderRow。解决方案:

细胞[I]。文本;


I've a gridview in my web form and I'm using a the following code in my web form's Save button:

foreach (GridViewRow row in gvList.Rows)
            if (row.RowType == DataControlRowType.DataRow)
            {  for (int i = 0; i < row.Cells.Count; i++)
                {
                    string headerRowText = ???;

How can I get the current cell's header text.

解决方案

I solved it using:

  string headerRowText = gvList.HeaderRow.Cells[i].Text;

这篇关于获取Gridview单元格的标题文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆