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

[Solved] Access user controls from grid

2 Answers 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
eric
Top achievements
Rank 1
eric asked on 15 Sep 2009, 05:18 PM
I have a grid that is using a usercontrol as an edit form.  This grid allows for multiple edits at one time.  My problem is that I don't know how to reference the user controls from the parent page.  I only know how to access the user controls from a grid event and in this case it is not a grid event that I need to handle, but instead i am handling a button click on the parent page.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 16 Sep 2009, 05:59 AM
Hello Eric,

You can access the user control for each row in the grid on button click as shown below:
c#:
protected void Button_Click(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.EditItems) 
        { 
            UserControl userCntrl = (UserControl)item.EditFormItem.FindControl(GridEditFormItem.EditFormUserControlID); 
            
        } 
    } 

Thanks
Princy.
0
eric
Top achievements
Rank 1
answered on 28 Sep 2009, 10:51 PM
Thanks again Princy!
Tags
Grid
Asked by
eric
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
eric
Top achievements
Rank 1
Share this question
or