ASPNET GridView如何重命名列标题? [英] ASPNET GridView how to rename column header?
问题描述
亲爱的所有人, var 用户= 来自 u in Db.UserTbls 选择 û ; Dear All, var Users = from u in Db.UserTbls select u; mGridView.DataSource = Users; mGridView.DataSource = Users; mGridView.DataBind(); mGridView.DataBind(); 试试这个 这篇关于ASPNET GridView如何重命名列标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
我真的无法想象只重命名列标题有多难。
我正在使用LINQ来查询这样的内容。
I really can't imagine how difficult to rename just a column header.
I am using LINQ to query something like this.
有一个" ;用户ID"我希望将其重命名为"用户ID"的列。剩余部分(自动生成)。
但遗憾的是,我无法轻易做到这一点。
我设法在RowCreated中重新命名。但随后它消除了其他格式化(如排序功能)。 :(
There is a "UserID" column which I wish to rename to "User ID". And leave the rest (auto generated).
But unfortunately there isn't a way I can do this easily.
I manage to rename it in the RowCreated call back. But then it erased other formating (like the capability to sort). :(推荐答案
With Me.GridView1
.DataSource = ds 'DataSet
.DataMember = "Region" 'DataTable
.DataBind()
End With
With Me.GridView1.HeaderRow
.Cells(0).Text = "Region ID"
.Cells(1).Text = "Region"
End With