Iterate through Panels

Discussion in 'ASP .Net' started by Fabian, Oct 4, 2004.

  1. Fabian

    Fabian Guest

    In my ASP.NET page I create panel controls dynamically. Now, I will loop
    through all my dynamically created panels.

    How I can do this?



    Thanks for help

    Fabian
    Fabian, Oct 4, 2004
    #1
    1. Advertising

  2. Panels are added to the control collection of the page. As such, the only way
    I know is to loop through controls and using GetType() to figure if it is a
    Panel object.


    ---

    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    ***************************
    Think Outside the Box!
    ***************************

    "Fabian" wrote:

    > In my ASP.NET page I create panel controls dynamically. Now, I will loop
    > through all my dynamically created panels.
    >
    > How I can do this?
    >
    >
    >
    > Thanks for help
    >
    > Fabian
    >
    >
    >
    >
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN, Oct 4, 2004
    #2
    1. Advertising

  3. Fabian

    Matt Berther Guest

    Hello Cowboy (Gregory A. Beamer) - MVP,

    How about

    foreach (Panel p in this.Controls)
    {
    // do something
    }

    --
    Matt Berther
    http://www.mattberther.com

    > Panels are added to the control collection of the page. As such, the
    > only way I know is to loop through controls and using GetType() to
    > figure if it is a Panel object.
    >
    > ---
    >
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBA
    > ***************************
    > Think Outside the Box!
    > ***************************
    > "Fabian" wrote:
    >
    >> In my ASP.NET page I create panel controls dynamically. Now, I will
    >> loop through all my dynamically created panels.
    >>
    >> How I can do this?
    >>
    >> Thanks for help
    >>
    >> Fabian
    >>
    Matt Berther, Oct 4, 2004
    #3
    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. Saravanan Rathinavelu

    Iterate through ArrayList using an another ArrayList

    Saravanan Rathinavelu, Aug 16, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    2,730
    Natty Gur
    Aug 19, 2003
  2. Gogo
    Replies:
    1
    Views:
    2,086
    Sudsy
    Sep 4, 2003
  3. runescience
    Replies:
    0
    Views:
    1,444
    runescience
    Feb 9, 2006
  4. Rob Meade

    Iterate through all panels on webform?

    Rob Meade, Jan 16, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    316
    Rob Meade
    Jan 16, 2007
  5. John
    Replies:
    4
    Views:
    898
    RedGrittyBrick
    Apr 1, 2008
Loading...

Share This Page