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

Set Header Text for Detail Table

2 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mario Turcotte
Top achievements
Rank 1
Mario Turcotte asked on 03 Feb 2009, 07:59 PM
Hello, I have a grid with two Detail Tables. Due to user language specific, I need to set the Headers text from codebehind. I have set the Datamember of both detail table but still in a lost on how to access the "HeaderText: property". My guess is from the ItemdataBound Event but how?

Anyone has a sample I could use?

Thanks in advance, Mario

2 Answers, 1 is accepted

Sort by
0
Mario Turcotte
Top achievements
Rank 1
answered on 03 Feb 2009, 09:43 PM
Well, I found a way. It's not an elegant way but do the job. Here for those who may need it.

>>> From the Page Load Event <<<

GridName.MasterTableView.DetailTables.Item(x).GetColumn("ColumnName").HeaderText = "Header Text"

Where x is the base zero array of your grid child grids

I believe this can be performed in the Init/Load/Prerender events
0
Daniel
Telerik team
answered on 04 Feb 2009, 10:13 AM
Hello Mario,

You can also use the ItemCreated handler if you find this approach more convenient:
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridHeaderItem && e.Item.OwnerTableView.Name == "tableView1"
            ((GridHeaderItem)e.Item)["Name"].Text = "TABLE1"
    }     

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Mario Turcotte
Top achievements
Rank 1
Answers by
Mario Turcotte
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or