5 Answers, 1 is accepted
0
Hello Matt,
Here is an example how to do this in ItemCreated:
if(e.Item is GridEditableItem && e.Item.IsInEditMode)
{
UserControl userControl=(UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
}
You may need to cast also to your control type.
Kind regards,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Here is an example how to do this in ItemCreated:
if(e.Item is GridEditableItem && e.Item.IsInEditMode)
{
UserControl userControl=(UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
}
You may need to cast also to your control type.
Kind regards,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

MD
Top achievements
Rank 1
answered on 12 Nov 2008, 01:55 PM
Thanks for the response, but the problem with doing it at that time is that the user control has already been created and loaded so the Page_Load on the user control has already occured.
Matt
Matt
0
Hi Matt,
Indeed the user control edit form will be initialized inside the ItemCreated event hander of the grid since by that time the controls which will reside in the grid cells are created (see this topic from the documentation for more details). Nevertheless, you can still set the public properties of the WebUserControls custom edit form inside the ItemCreated handler by accessing directly the user control instance as explained by my colleague Vlad.
Best regards,
Stephen
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Indeed the user control edit form will be initialized inside the ItemCreated event hander of the grid since by that time the controls which will reside in the grid cells are created (see this topic from the documentation for more details). Nevertheless, you can still set the public properties of the WebUserControls custom edit form inside the ItemCreated handler by accessing directly the user control instance as explained by my colleague Vlad.
Best regards,
Stephen
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

MD
Top achievements
Rank 1
answered on 21 Nov 2008, 05:03 PM
Is there a way to programatically assign an instance of a usercontrol so that properties can be set before it is loaded and not just assign the name of the user control through EditFormSettings.UserControlName?
0
Accepted
Hi Matt,
You can use FormTemplate instead where you can load/create your user control manually.
Regards,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can use FormTemplate instead where you can load/create your user control manually.
Regards,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.