GuyFawkes
GuyFawkes

Reputation: 1706

Nested GridView - Get ID from Parent

I am stuck here.

I have a GridView with another GridView (As A Template Column as a User Control) nested in it. Both are bound to an ObjectDataSource. My Problem now is how I pass the ID from the Parent Row to the Child Grid in order to only show the relevant data.

Example:

<ParentGridView>
 <Columns>
  <ID/>
  <ChildGridView/>
 </Columns>
</ParentGridView>    

How can i pass the ID from ParentGridView to ChildGridView ?

Thank you.

Upvotes: 0

Views: 1932

Answers (1)

huMpty duMpty
huMpty duMpty

Reputation: 14470

try something like this

var gvParent= (GridViewRow)gvChild.Parent.Parent;

or

var gvParent= (GridViewRow)gvChild.Parent.Parent.Parent;

Also have a look at this article about Creating a Nested GridView Control

Upvotes: 1

Related Questions