Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested gridview help

Status
Not open for further replies.

Trebor100

Programmer
Mar 14, 2006
90
GB
Hi all,
Does anyone know how to reference a control on the current row of a gridview from the rowcommand of a nested gridview?

i.e. im writing a custom save function in the rowcommand of the child gridview and need to get the value of a textbox from the current row in the parent gridview. I'm working in .net 2.0

Any help would be much appreciated.

Rob
 
Okay I've got it working with:
GridViewRow gvr2 = (GridViewRow)((Control)e.CommandSource).Parent.Parent.Parent.Parent.Parent.Parent.Parent;

Not exactly nice but hay.. it works! If anyone knows a clean method of doing this please let me know.

Also Does anyone know why you cannot reference the value or control inside a column that is invisible?

ie gvr2.cells[0] will return the text inside the column if the row is visible however this will return an empty string if the column is not visible...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top