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

Radgrid Programmatic creation

1 Answer 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ivan Ruiz
Top achievements
Rank 1
Ivan Ruiz asked on 27 Mar 2009, 08:54 PM
Hi,
I need to create a customized RadGrid, I need to create all of its fields and events at run time. I am able to create all of its fields at run time, but I cannot associate any Event to my Custom RadGrid. I have been trying to do this using the AddHandler instruction without successful, How can I create Events for a RadGrid Created at run time for paging instruction or Edit Command events or any other event of the grid or of tis controls inside?

Francisco Ruiz

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Mar 2009, 04:24 AM
Hi Francisco Ruiz,

Give a try with the following code snippet and see whether it helps.

CS:
 
 
   protected void Page_Init(object sender, System.EventArgs e) 
    { 
        RadGrid Grid = new RadGrid(); 
        Grid.ID = "RadGrid1"
        Grid.DataSourceID = "SqlDataSource1"
        Grid.AutoGenerateEditColumn = true
        PlaceHolder1.Controls.Add(Grid); 
      
        
        Grid.EditCommand += new GridCommandEventHandler(Grid_EditCommand); 
        Grid.PageIndexChanged += new GridPageChangedEventHandler(Grid_PageIndexChanged); 
    } 
 
    void Grid_PageIndexChanged(object source, GridPageChangedEventArgs e) 
    { 
         
    } 
 
    void Grid_EditCommand(object source, GridCommandEventArgs e) 
    { 
         
    } 


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