1 Attachment(s)
Get nested Grid control values
hi
im using nested databound controls in my page.
<asp:repeater id="packg" ....>
....
<itemtemplate>
<asp:datagrid id="grid"....>
<itemtemplate>
<!-- -some table with server controls -->
</itemtemplate>
</asp:datagrid>
</itemtemplate>
...
</asp:repeater>
i want to get the inner most text box values from the datagrid.
here im attaching the trace potion of the output. the submit button is inclued in each datagrid item template.
NB: if i put the command in debug mode it returns correct value as follows:
?request("packg:_ctl0:grid:_ctl2:lstadt")
"Adult"
but i dont know how to acheive the same result using findcontrol method
Pls can any one help me abt this critical situation.
thanku
v.r.mahendran
Re: Get nested Grid control values
Blimey right you'd need to know which item index you wanted in the repeater and all the the datagrids or loop through the repeater items and have another loop inside to loop through all the datagrid items.
What are you using this for seems very complex?
First within the repeater item loop:
Code:
DataGrid tempDgrd = (DataGrid) packg.Items[itemNum].FindControl("grid");
Then you need to loop through this local DataGrid and find the textboxes:
Code:
TextBox txtBox1 = (TextBox) tempDgrd.Items[dgItemNum].FindControl("txtBoxID");
There may well be a better way of doing this though as this will loop through every repeater item and every datagrid and datagrid item.
DJ