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

UserAddedRow for dynamically create RadGridViews

1 Answer 48 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 10 Jan 2013, 12:59 PM
hi,
i have an application where i am creating gridviews at run time. at a given time, the application can have 1 or x number of girdviews, each being hooked with the UserAddedRow event:
void myGrid_UserAddedRow(object sender, GridViewRowEventArgs e) { }

how can i, using the "sender" or the "e" parementers of the event handler get a reference to the associated GridView? the sender here is a Telerik.WinControls.UI.GridViewTemplate for which i am not able to find a property which would return the GridView object.

thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Jack
Telerik team
answered on 11 Jan 2013, 03:04 PM
Hi Steve,

You can do this by accessing the MasterTemplate and its Owner property. Consider the code snippet below:

void radGridView1_UserAddedRow(object sender, GridViewRowEventArgs e)
{
    GridViewTemplate template = (GridViewTemplate)sender;
    RadGridView grid = template.MasterTemplate.Owner;
    //...
}

I hope it helps.
 
Kind regards,
Jack
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Tags
GridView
Asked by
Steve
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or