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

Me again, same problem

3 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Catalina
Top achievements
Rank 1
Catalina asked on 18 Jun 2012, 01:22 PM
I want to access controls inside RadGrid's EditFormTemplate from page_load (not from RadGrid1_ItemDataBoundRadGrid1_UpdateCommand or any other "events" ), or something like this  ... is this possible?

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 18 Jun 2012, 01:42 PM
Hello Catalina,

yes it is possible.
try with below code snippet.
protected void Page_Load(object sender, EventArgs e)
    {
        foreach (GridDataItem item in RadGrid1.EditItems)
        {
            GridEditableItem itemToEdit = (item.OwnerTableView.EditMode == GridEditMode.InPlace) ? (GridEditableItem)item : (GridEditableItem)item.EditFormItem;
            RadGrid RadGrid2 = item.FindControl("RadGrid2") as RadGrid;
 
        }
}


Thanks,
Jayesh Goyani
0
Catalina
Top achievements
Rank 1
answered on 21 Jun 2012, 06:18 PM
RadGrid2 is null
0
Shinu
Top achievements
Rank 2
answered on 22 Jun 2012, 05:19 AM
Hi Catalina,

Referencing the FormTemplate custom edit form on PageLoad is not the most convenient place to do that. One suggestion is you can access the controls in prerender event as shown below.
C#:
void RadGrid1_PreRender(object sender, EventArgs e)
 {
    foreach(GridDataItem item in RadGrid1.EditItems)
     {
        foreach (GridEditFormItem itemm in RadGrid1.MasterTableView.GetItems(GridItemType.EditFormItem))
        {
           RadGrid grid = itemm.FindControl("RadGrid2") as RadGrid;
        }
     }
}
Also check the following help documentation which explains event sequence of radgrid in detail.
Event sequence

Thanks,
Shinu.
Tags
Grid
Asked by
Catalina
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Catalina
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or