获取网格的列名 [英] get column name of grid

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

问题描述

如何在asp.net中获取网格的列名? 请帮我...
提前thnks ...

how to get column names of grid in asp.net????
plz help me...
thnks in advance...

推荐答案


您可以使用
进行列
Hi
You can column by using

Label1.Text = grdEmpDet.Columns[1].HeaderText;



您还可以ron for loop查找网格中的每个列名称



you can also ron for loop for finding each column name in grid

for (int i = 0; i <= grdEmpDet.Columns.Count; i++)
       {
           Label1.Text = grdEmpDet.Columns[i].HeaderText;
       }



希望对您有帮助



Hope this will help you


请参考以下代码.

Refer the following code.

string colnames = string.Empty;
           for (int i = 0; i < GridView1.Columns.Count; i++)
              colnames += GridView1.Columns[i].HeaderText;


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

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