Scenario
I am creating a user control that contains a RadGrid. The user control will have properties that specify the order of the columns in the RadGrid. I plan on using code similar to the snippet taken from http://www.telerik.com/help/aspnet-ajax/grid-reordering-columns.html
Question
1. At what point in the pages life cycle should the code be executed? (i.e. page_load, page_init etc)
2. If I do not want to execute the code based on the page lifecycle, are there event(s) based on the RadGrid's life cycle that can be used to execute the code? (i.e. RadGrid1_Init, RadGrid1_Load, RadGrid1_PreRender, RadGrid1_ColumnCreated etc)
3. Any gotcha's I should be aware about?
I am creating a user control that contains a RadGrid. The user control will have properties that specify the order of the columns in the RadGrid. I plan on using code similar to the snippet taken from http://www.telerik.com/help/aspnet-ajax/grid-reordering-columns.html
GridColumnCollection cols = grid.MasterTableView.Columns;
GridColumn c = cols.FindByUniqueName(columnName);
if
(c !=
null
){
int
start = c.OrderIndex;
for
(
int
i= start; i < cols.Count; i++)
{
c = cols[i];
if
(i < cols.Count - 1)
c.OrderIndex = i+1;
else
c.OrderIndex = start;
}
}
Question
1. At what point in the pages life cycle should the code be executed? (i.e. page_load, page_init etc)
2. If I do not want to execute the code based on the page lifecycle, are there event(s) based on the RadGrid's life cycle that can be used to execute the code? (i.e. RadGrid1_Init, RadGrid1_Load, RadGrid1_PreRender, RadGrid1_ColumnCreated etc)
3. Any gotcha's I should be aware about?