I have 2 GridViews, the InnerGridView is nested inside a TemplateField of my OuterGridView. Each GridView has an ObjectDataSource (ODS). I want the InnerGridView to display data that is unique to the GroupName that is listed in the OuterGridView. I have been Googling this for weeks, seeing various ideas based around RowDataBound and the ODS Selecting event.
I don't think RowDataBound is the answer, because the Selecting event for the InnerGridView ODS has already been called when RowDataBound is called for the OuterGridView.
So, I need to send a parameter to the ODS for the InnerGridView:
protected void ProductDataSource_Selecting( object sender, ObjectDataSourceSelectingEventArgs e ) {
e.InputParameters["productGroup"] = <here I need to access the GroupName from the OuterGridView>;
}
Note: This method is assigned to the Selecting event of the InnerGridView ODS.
My question is: How do I access the GroupName from the OuterGridView... while I am processing the InnerGridView. Here is an example of something that does not work: OuterGridView.SelectedRow.FindControl( "GroupName" ).ToString();
I have heard that one can find any control from inside the Selecting event by searching a certain hierarchy. But I don't know how to access that hierarchy using the "e" or "sender" parms. If I could find an explanation of the various objects and controls... and where they have a valid scope and how they are accessed... that would be helpful.
Many thanks, Paul