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

[Solved] How to set column header text dynamically

1 Answer 180 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 23 Apr 2008, 10:23 PM
Hi,

I have a couple of columns which the data always returns the current qtr and the next quarter costs. I have labelled these CQ C and NQ C...as the quarter returned in these is based on todays date and which quarter we are in.

How can I, when the data is bound, rewrite the column headings to read Q1-08, Q2-08 - so I dont have to hard code the quarter names, and dont have to use cryptic descriptions.

Thanks 

Indy

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Apr 2008, 05:52 AM
Hi Stephen,

You can dynamically set the column header text as shown below.

CS:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridHeaderItem) 
        { 
            GridHeaderItem header = (GridHeaderItem)e.Item; 
            header["columnUniqueName"].Text = "CustomHeaderText"
        } 
   } 


Thanks
Shinu.
Tags
Grid
Asked by
Stephen
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or