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

Assign HeaderText Dynamically

2 Answers 346 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vishnu
Top achievements
Rank 1
Vishnu asked on 13 Dec 2013, 09:52 AM
Hi. I am using Telerik version 2011. I want to assign / change the Headertext. I have used 2 to 3 types. but its not getting work. Please let me know in which event we can assign or set the headertext of column.



RadGrid1.Columns[0].HeaderText = "Rank";

I have applied above code in Page_Load event , RadGrid's ItemDataBound Event still column heading not set. 
Please help me out in this. 

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 13 Dec 2013, 06:59 PM
Hello,

<telerik:GridBoundColumn HeaderText="OrderID"   DataField="OrderID"
            UniqueName="OrderID">

1.
GridBoundColumn OrderIDColumn = (GridBoundColumn)RadGrid1.MasterTableView.GetColumn("OrderID");  
    OrderIDColumn.HeaderText= "your text";

2.
RadGrid1.MasterTableView.Columns.FindByUniqueName("OrderID").HeaderText = "YourText";

Note : please also set this header text in Page/Radgrid PreRender event. If still this is not worked then make sure that not any global property created for this or globalization property/key assigned to this column.

Thanks,
Jayesh Goyani
0
Vishnu
Top achievements
Rank 1
answered on 17 Dec 2013, 09:49 AM
Thanks Jayesh for your helpful answer.
I was using your 2nd method in Page_Load Event, it wasn't applying. Later I written the same code in ItemDataBound Grid's Event, then its working well... 

Anyways I wasn't aware of your 1st method type. Thanks for your response... 
Thanks a lot... :)

Tags
Grid
Asked by
Vishnu
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Vishnu
Top achievements
Rank 1
Share this question
or