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

Accessing userControl editForm data

2 Answers 178 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Louis-Philippe
Top achievements
Rank 1
Louis-Philippe asked on 21 Feb 2011, 09:24 PM
Hello,
I have a page containing two radGrid, one of them using a userControl as an editForm. When the user click on the update button, I have no trouble accessing the data from the UpdateCommand event. But, if the user click on the other radGrid, I need to exit edit mode, so I whant to do some verification and update the data if needed, but I can't find a way to access the user control containing the data. Since I was accessing the data from ItemDataBound and UpdateCommand this way
UserControl scheduleApprobationEditForm = e.Item.FindControl(GridEditFormItem.EditFormUserControlID) as UserControl;
I tried to access the data using the same idea from outside of my grid's events
UserControl userControl = (UserControl)_radg.EditItems[0].FindControl(GridEditFormItem.EditFormUserControlID);
But userControl stays null. I can access the item been edited as a GridEditableItem, but I haven't found a way to extract my userControl from it. So how can I access the userControl representing my editForm from anywhere in my code?

Thank you for your help,
LP

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 Feb 2011, 05:55 AM
Hello Louis,

Try the following approach to access the UserControl.

C#:
GridEditFormItem editedItem = (GridEditFormItem)_radg.MasterTableView.GetItems(GridItemType.EditFormItem)[0];
 UserControl userControl = (UserControl)editedItem.FindControl(GridEditFormItem.EditFormUserControlID);


Thanks,
Princy.
0
Louis-Philippe
Top achievements
Rank 1
answered on 22 Feb 2011, 02:46 PM
It does the trick! Thank you very much and have a nice day.

LP
Tags
Grid
Asked by
Louis-Philippe
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Louis-Philippe
Top achievements
Rank 1
Share this question
or