This is a migrated thread and some comments may be shown as answers.

Autogenerate Columns Header Text Changes

2 Answers 175 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 15 Jan 2014, 09:53 PM
Is there any way alter the Column Header Text when auto-generating the columns in a RadGrid?

Thanks,
Mark

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Jan 2014, 03:34 AM
Hi Mark,

When you want to customize the auto-generated columns of RadGrid, you could use the OnColumnCreated server event. It fires for each auto-generated column in RadGrid (including structure columns). You can get the column from the event arguments and check its data type or unique name to recognize it. In this event you could set the column properties and customize the look and behavior of the column.
Please try the following code snippet to change the HeaderText:

C#:
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
{
 if (e.Column.UniqueName == "Name")
  {
   e.Column.HeaderText = "Customer Name";      
  }
}

Thanks,
Princy
0
Mark
Top achievements
Rank 1
answered on 16 Jan 2014, 03:50 AM
Princy, 

Perfect, thanks! 

I actually asked this question in the RadTreeView section, but can you please tell me if it is possible to use a SqlDataSource with null Parent date fields with the RadTreeView?  

The whole post is at:
http://www.telerik.com/community/forums/aspnet-ajax/treeview/radtreeview-error-when-parent-null.aspx

Thanks again! 

-Mark
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Mark
Top achievements
Rank 1
Share this question
or