How can i change the Header Text of Autogenerated DataBound Columns in RADGRID. I am loading a dataset whoz columns are autogenerated (Wgt1,Wgt2,Wgt3.......). I want these Column Headers as
Wgt | abc | Wgt | edg | Wgt |....... wh开发者_如何学编程ich at the moment is coming as
Wgt1 | abc | Wgt2 | edg | Wgt3 |.......
I tried
If (TypeOf e.Item Is GridDataItem) Then
For Each column1 As GridColumn In e.Item.OwnerTableView.RenderColumns Dim dataItem As GridDataItem = DirectCast(e.Item, GridDataItem) If column1.HeaderText = "Wgt1" Then dataItem("Wgt1").Text = "Wgt" End If Next End IfBut this is changing the Column Data and not the Header Text
protected void RadGrid2_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
dynamic data = new[] {
new { ID = 1, Name ="Name1"},
new { ID = 2, Name = "Name2"},
new { ID = 3, Name = "Name3"},
new { ID = 4, Name = "Name4"},
new { ID = 5, Name = "Name5"}
};
RadGrid2.DataSource = data;
}
protected void RadGrid2_ColumnCreated(object sender, Telerik.Web.UI.GridColumnCreatedEventArgs e)
{
if (e.Column.UniqueName == "Name")
{
e.Column.HeaderText = "Jayesh";
}
}
精彩评论