读取GridView的绑定字段列的DataField [英] Read DataField of a bound field column for a GridView
本文介绍了读取GridView的绑定字段列的DataField的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们可以在asp.net应用程序中读取GridView的绑定字段列的DataField吗?
我想在运行时为任何网格创建一个数据表.
Can we read DataField of a bound field column for a GridView in the asp.net application?
I want to create a data table at run time for any grid.
public static void fnSetBlankGridMessage(GridView gv, string strMessage)
{
.
.
.
}
以下是我的aspx代码
Following is my aspx code
<asp:BoundField DataField="Service_Number" HeaderText="Service">
<HeaderStyle CssClass="grdheader" />
我想在运行时阅读"Service_Number"
.
I want to read "Service_Number"
at runtime.
推荐答案
AmolPandurangBorkar,
请尝试下面给出的解决方案.它可以帮助您读取GridView绑定列的DataField属性.
Hi AmolPandurangBorkar,
Please try the solution given below. It may help you to read DataField property of a bound column for a GridView.
System.Text.StringBuilder sbBoundFieldNames = new System.Text.StringBuilder();
foreach (System.Web.UI.WebControls.BoundField bfName in this.GridView1.Columns)
{
sbBoundFieldNames.Append("<br />" + bfName.DataField);
}
Response.Write(sbBoundFieldNames.ToString());
问候,
Ambicaprasad毛里雅
Regards,
Ambicaprasad Maurya
这篇关于读取GridView的绑定字段列的DataField的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文