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

Create RadGrid Header Dynamically

1 Answer 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bricton Perez
Top achievements
Rank 1
Bricton Perez asked on 26 Jul 2010, 05:55 PM
Hi to everyone,

I'm using a RadGrid, I would like to know if some of you have created a dynamic header, based on a table data column..Can you tell me how can I do it, otherwise where can I find some source code...I appreciate your help, I attach a gif file

Regards

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 27 Jul 2010, 07:10 AM
Hello Bricton,

Try the following code snippet to change the HeaderText of columns dynamically.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
   {
       RadGrid1.MasterTableView.GetColumn("ColumnUniqueName").HeaderText = "Header Text";
       RadGrid1.MasterTableView.AutoGeneratedColumns[0].HeaderText = "Header Text";// For AutoGeneratedColumns
       RadGrid1.Rebind();
   }

Thanks,
Princy.
Tags
Grid
Asked by
Bricton Perez
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or