Re: Loop through controls on Page_Load event

Discussion in 'ASP .Net' started by Eliyahu Goldin, May 13, 2004.

  1. Are all of your 6 controls direct children of the page? Or only 3 of them
    and the other are nested? Controls collection includes only direct children

    Eliyahu

    "Kent" <> wrote in message
    news:...
    > I'm trying to loop through the 6 server controls I have on my asp page

    during the Page_Load event. Why don't the controls show up in the Controls
    collection? I realize that the controls are not rendered at this point, but
    there must be a way to loop through them. Here the code I have tried. When
    I do a count on the controls collection it is 3 even though I have six.
    >
    > Private Sub Page_Load(...)
    > Dim oControl as Control
    >
    > For each oControl in Me.Controls
    > if oControl.ID = "txtAcct" then
    > 'do some
    > end if
    > Next
    > End Sub
    >
    > Thanks,
    > Kent
    >
    >
    >
     
    Eliyahu Goldin, May 13, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bminder
    Replies:
    1
    Views:
    2,194
    nfedin
    Feb 23, 2004
  2. Andy Gaskell
    Replies:
    0
    Views:
    455
    Andy Gaskell
    May 13, 2004
  3. Scott Allen
    Replies:
    0
    Views:
    497
    Scott Allen
    May 14, 2004
  4. rockdale
    Replies:
    1
    Views:
    683
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Nov 16, 2006
  5. Isaac Won
    Replies:
    9
    Views:
    419
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page