asp.net gridview列数据字段属性 [英] asp.net gridview column datafield properties

查看:67
本文介绍了asp.net gridview列数据字段属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何从gridview列获取基础数据字段属性吗?

具体来说,我对获取数据字段的名称和类型感兴趣.


Does anyone know how to get the underlying datafield properties from a gridview column?

Specifically, I am interested in getting the name and type of the datafield.

Something like

for (int x = 0; x < grdCustList.Columns.Count; x++)
{
          //get the columns underlying datafield name and type
}


在此先感谢您!


Thanks in advance!

推荐答案

可以说,您拥有所有绑定的字段.以下代码应执行:
Lets say, you have all bound fields. Following code should do:
foreach (System.Web.UI.WebControls.BoundField bfName in grdCustList.Columns)
{
    string currentDataField =  bfName.DataField;
    // Do whatever you want to with it here.
}


这篇关于asp.net gridview列数据字段属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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