-1

这是我的简单 LINQ 查询,它返回一行,我将它绑定到网格视图。默认情况下,我在网格视图中得到的列名是“ITEM”。如何将其更改为自定义名称?

protected void Page_Load(object sender, EventArgs e)
{
        int[] a = {10,20,30,40,50 };
        var iList =from n in a
                   where n>10
                    select n;
        _gridView1.DataSource = iList;
        _gridView1.DataBind();
}

我的输出:

在此处输入图像描述

4

2 回答 2

0
string colName="Custom Col Name";
_gridView1.Columns[0].HeaderText = colName;
于 2013-11-04T07:59:11.020 回答
0

为此使用 HeaderText 属性。在此处查看更多详细信息:asp.net 中的 GridView 标题文本

于 2013-11-04T07:59:17.920 回答