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

setting preRender for dynamically created radgrids

1 Answer 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
preeti
Top achievements
Rank 1
preeti asked on 27 Sep 2014, 02:28 PM
I am creating multiple radgrids from a single dataset, programatically. Each table in the dataset is displayed as a separate radgrid. I am trying to specify the width/font of the columns (same values for all the grids). How do I set preRender handler for each grid programatically?

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 01 Oct 2014, 03:06 PM
Hi Preeti,

In order to attach handler for a grid event in the code-behind you can use the OnInit event of the page. The code will look similar to the following:

protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
 
    RadGrid1.PreRender += RadGrid1_PreRender;
    RadGrid2.PreRender += RadGrid2_PreRender;
    RadGrid3.PreRender += RadGrid3_PreRender;
}
 
void RadGrid1_PreRender(object sender, EventArgs e)
{
    // code regarding the first grid
}
 
void RadGrid2_PreRender(object sender, EventArgs e)
{
    // code regarding the second grid
}
 
void RadGrid3_PreRender(object sender, EventArgs e)
{
    // code regarding the third grid
}

If you would like additional information about subscribing to events you would find the following article interesting.
Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
preeti
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or