Re: Iterating through Controls Question
From: Andrew (andrewr2k1_at_hotmail.com)
Date: 09/29/04
- Next message: Raghavendra V: "Re: Calendar control WITHOUT Postback"
- Previous message: Alex: "Re: Prevent controls from inheirting ID of parent"
- In reply to: Alvin Bruney [MVP]: "Re: Iterating through Controls Question"
- Next in thread: Alvin Bruney [MVP]: "Re: Iterating through Controls Question"
- Reply: Alvin Bruney [MVP]: "Re: Iterating through Controls Question"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 29 Sep 2004 10:47:24 -0700
Alvin,
I appreciate the time and effort of your response and thank you, but I have
the thing working just fine and using the debugger was part of how I managed
that. With this application, I have the "what", I am attempting to
understand the "why". Not harping on you, but sometimes, I really am after
the answer to the question I asked. I just have to leave it up to those out
here to read the question as I wrote it.
-- Andrew
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:#t#HVWbpEHA.4076@TK2MSFTNGP12.phx.gbl...
> i could explain but the easier way to understand it is to step thru loop 1
> and 2 with the debugger
> paying attention to what is returned. then you can use the watch window to
> see how the control
> container is setup. that way you will understand what is going on
internally
> as opposed to reading
> fluffy stuff. its the best way to learn.
>
> --
> Regards,
> Alvin Bruney
> [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
> Got tidbits? Get it here... http://tinyurl.com/27***
> "Andrew" <andrewr2k1@hotmail.com> wrote in message
> news:OpMkh1YpEHA.596@TK2MSFTNGP11.phx.gbl...
> > Hey all,
> >
> > I am still getting the hang of .Net so I'm posting this question
> > looking
> > for someone to maybe explain the following process to me so I can better
> > understand just what is going on here.
> > I have an aspx page with a few Panel Web Controls on it. I turn them
> > on
> > and off depending on what the user is doing. I wanted to make the code
a
> > little shorter on the back end by writing a subroutine that turns off
all
> > panels by iterating through the controls collection:
> >
> > My first attempt didn't go so well:
> > For Each p As Panel In Me.Controls
> > p.Visible = False
> > Next
> >
> > After some searching on Google, CodeProject, and the MSDN help files,
I
> > was able to correct the function so it worked:
> > For Each c As Control In Me.Controls.Item(1).Controls
> > If TypeOf c Is Panel Then
> > c.Visible = False
> > End If
> > Next
> >
> > My question is in two parts: 1 - Obviously, why did the first one not
> > work, and 2 - Why do I need to use "Me.Controls.Item(1).Controls" to
> > access
> > the controls collection for the page?
> >
> > Again, I am still getting a handle on all this, so I appreciate any
> > replies to be as simple and straight forward as possible. :) Thanks!
> >
> > -- Andrew
> >
> >
>
>
- Next message: Raghavendra V: "Re: Calendar control WITHOUT Postback"
- Previous message: Alex: "Re: Prevent controls from inheirting ID of parent"
- In reply to: Alvin Bruney [MVP]: "Re: Iterating through Controls Question"
- Next in thread: Alvin Bruney [MVP]: "Re: Iterating through Controls Question"
- Reply: Alvin Bruney [MVP]: "Re: Iterating through Controls Question"
- Messages sorted by: [ date ] [ thread ]