Click here to Skip to main content
15,881,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a project in which i need to get parent gridview row on rowdatabound of child grid,i got the row number of parent from first child using code

string _ID = ((HiddenField)e.Row.Parent.Parent.Parent.FindControl("HdnID")).Value;

but this code is not working with the second child grid(I have three grids) it shows object reference error
Posted
Comments
Can you try like below...

gvChild.Parent.FindControl("HdnID");
vishnushanmughan 19-Sep-14 8:37am    
it will retrieve only first parent hidden field id .I need super parent controls
Then go to the next parent, something like...

gvChild.Parent.parent.FindControl("HdnID");
vishnushanmughan 22-Sep-14 0:44am    
gvChild.Parent.parent.parent.FindControl("HdnID");

it will only retrieve parent grid not super parent

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900