Results 1 to 2 of 2

Thread: Get nested Grid control values

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Location
    india
    Posts
    95

    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
    Attached Images Attached Images  

  2. #2
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width