Re: Loop through controls on Page_Load event

Discussion in 'ASP .Net' started by Scott Allen, May 14, 2004.

  1. Scott Allen

    Scott Allen Guest

    Some of the controls might be container for additional controls. Take
    a look at http://odetocode.com/Code/71.aspx.

    HTH,

    --
    Scott

    On Thu, 13 May 2004 12:16:04 -0700, "Kent"
    <> wrote:

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


    --
    Scott
    http://www.OdeToCode.com
    Scott Allen, May 14, 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,154
    nfedin
    Feb 23, 2004
  2. Andy Gaskell
    Replies:
    0
    Views:
    439
    Andy Gaskell
    May 13, 2004
  3. Eliyahu Goldin

    Re: Loop through controls on Page_Load event

    Eliyahu Goldin, May 13, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    433
    Eliyahu Goldin
    May 13, 2004
  4. rockdale
    Replies:
    1
    Views:
    649
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Nov 16, 2006
  5. Isaac Won
    Replies:
    9
    Views:
    351
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page