473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Page.Controls - controls are missing?

Hi,

I created an ASP.NET page (test.aspx) with some web controls in GridLayout
(Design time).

When I look at the collection page.controls by

foreach (Control ctrl in Page.Controls)
{
....
}

then I can not see all the controls on the page.

Is there a special controls collection for the design time gridlayout
controls?

Best regards
Frank
(newbie)
Nov 19 '05 #1
11 1575
Frank,

Every Control collection contains only immediate children.

Eliyahu

"Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi,

I created an ASP.NET page (test.aspx) with some web controls in GridLayout
(Design time).

When I look at the collection page.controls by

foreach (Control ctrl in Page.Controls)
{
....
}

then I can not see all the controls on the page.

Is there a special controls collection for the design time gridlayout
controls?

Best regards
Frank
(newbie)

Nov 19 '05 #2
Hallo Eliyahu ,

thanks for your answer.

How can I iterate through the controls that were created at design time?
For example when I want to make all available controls invisible or disabled
at runtime?
At the moment I have to call them directly by name. This is very ugly for my
coding...

Thanks
Frank
"Eliyahu Goldin" <re*************@monarchmed.com> schrieb im Newsbeitrag
news:uH****************@TK2MSFTNGP12.phx.gbl...
Frank,

Every Control collection contains only immediate children.

Eliyahu

"Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi,

I created an ASP.NET page (test.aspx) with some web controls in
GridLayout
(Design time).

When I look at the collection page.controls by

foreach (Control ctrl in Page.Controls)
{
....
}

then I can not see all the controls on the page.

Is there a special controls collection for the design time gridlayout
controls?

Best regards
Frank
(newbie)


Nov 19 '05 #3
I must confess that in similar situations I do operate on controls
individually. Just to add a few extra lines of code is often a better idea
than spending hours on looking for more elegant solutions. If you don't want
this, you can either navigate Controls collections or try find a sort of
container element (a panel?) that would disable its children when it is
disabled.

Eliyahu

"Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hallo Eliyahu ,

thanks for your answer.

How can I iterate through the controls that were created at design time?
For example when I want to make all available controls invisible or disabled at runtime?
At the moment I have to call them directly by name. This is very ugly for my coding...

Thanks
Frank
"Eliyahu Goldin" <re*************@monarchmed.com> schrieb im Newsbeitrag
news:uH****************@TK2MSFTNGP12.phx.gbl...
Frank,

Every Control collection contains only immediate children.

Eliyahu

"Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi,

I created an ASP.NET page (test.aspx) with some web controls in
GridLayout
(Design time).

When I look at the collection page.controls by

foreach (Control ctrl in Page.Controls)
{
....
}

then I can not see all the controls on the page.

Is there a special controls collection for the design time gridlayout
controls?

Best regards
Frank
(newbie)



Nov 19 '05 #4
But if I want to write a global function that makes all controls on a web
page invisible for example then I have to use a generic way of accessing the
page controls...

I can not imagine that there is no way to do that in the .NET framework or
ASP.NET.
That would really be a strange mistake by Microsoft...

Other opinions?
"Eliyahu Goldin" <re*************@monarchmed.com> schrieb im Newsbeitrag
news:uU**************@TK2MSFTNGP09.phx.gbl...
I must confess that in similar situations I do operate on controls
individually. Just to add a few extra lines of code is often a better idea
than spending hours on looking for more elegant solutions. If you don't
want
this, you can either navigate Controls collections or try find a sort of
container element (a panel?) that would disable its children when it is
disabled.

Eliyahu

"Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hallo Eliyahu ,

thanks for your answer.

How can I iterate through the controls that were created at design time?
For example when I want to make all available controls invisible or

disabled
at runtime?
At the moment I have to call them directly by name. This is very ugly for

my
coding...

Thanks
Frank
"Eliyahu Goldin" <re*************@monarchmed.com> schrieb im Newsbeitrag
news:uH****************@TK2MSFTNGP12.phx.gbl...
> Frank,
>
> Every Control collection contains only immediate children.
>
> Eliyahu
>
> "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> news:%2***************@TK2MSFTNGP12.phx.gbl...
>> Hi,
>>
>> I created an ASP.NET page (test.aspx) with some web controls in
>> GridLayout
>> (Design time).
>>
>> When I look at the collection page.controls by
>>
>> foreach (Control ctrl in Page.Controls)
>> {
>> ....
>> }
>>
>> then I can not see all the controls on the page.
>>
>> Is there a special controls collection for the design time gridlayout
>> controls?
>>
>> Best regards
>> Frank
>> (newbie)
>>
>>
>
>



Nov 19 '05 #5
Navigate Controls collections. It is called recursion.

Eliyahu

"Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
news:eU**************@TK2MSFTNGP14.phx.gbl...
But if I want to write a global function that makes all controls on a web
page invisible for example then I have to use a generic way of accessing the page controls...

I can not imagine that there is no way to do that in the .NET framework or
ASP.NET.
That would really be a strange mistake by Microsoft...

Other opinions?
"Eliyahu Goldin" <re*************@monarchmed.com> schrieb im Newsbeitrag
news:uU**************@TK2MSFTNGP09.phx.gbl...
I must confess that in similar situations I do operate on controls
individually. Just to add a few extra lines of code is often a better idea than spending hours on looking for more elegant solutions. If you don't
want
this, you can either navigate Controls collections or try find a sort of
container element (a panel?) that would disable its children when it is
disabled.

Eliyahu

"Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hallo Eliyahu ,

thanks for your answer.

How can I iterate through the controls that were created at design time? For example when I want to make all available controls invisible or

disabled
at runtime?
At the moment I have to call them directly by name. This is very ugly for
my
coding...

Thanks
Frank
"Eliyahu Goldin" <re*************@monarchmed.com> schrieb im

Newsbeitrag news:uH****************@TK2MSFTNGP12.phx.gbl...
> Frank,
>
> Every Control collection contains only immediate children.
>
> Eliyahu
>
> "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> news:%2***************@TK2MSFTNGP12.phx.gbl...
>> Hi,
>>
>> I created an ASP.NET page (test.aspx) with some web controls in
>> GridLayout
>> (Design time).
>>
>> When I look at the collection page.controls by
>>
>> foreach (Control ctrl in Page.Controls)
>> {
>> ....
>> }
>>
>> then I can not see all the controls on the page.
>>
>> Is there a special controls collection for the design time gridlayout >> controls?
>>
>> Best regards
>> Frank
>> (newbie)
>>
>>
>
>



Nov 19 '05 #6
Hi Frank,

you can iterate through all controls in your page after the Init-Event was
executed. In case you want to set all sub-control unvisible do the following:

public class MyControl : System.Web.UI.Control /* or any other base-class
e.g. System.Web.UI.WebControls.WebControl */

...

void setVisibility(bool visible)
{
foreach (Control ctl in this.Controls)
{
ctl.Visible = visible;
}
}

...

}

Hope that helps
patrick

"Eliyahu Goldin" wrote:
Navigate Controls collections. It is called recursion.

Eliyahu

"Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
news:eU**************@TK2MSFTNGP14.phx.gbl...
But if I want to write a global function that makes all controls on a web
page invisible for example then I have to use a generic way of accessing

the
page controls...

I can not imagine that there is no way to do that in the .NET framework or
ASP.NET.
That would really be a strange mistake by Microsoft...

Other opinions?
"Eliyahu Goldin" <re*************@monarchmed.com> schrieb im Newsbeitrag
news:uU**************@TK2MSFTNGP09.phx.gbl...
I must confess that in similar situations I do operate on controls
individually. Just to add a few extra lines of code is often a better idea than spending hours on looking for more elegant solutions. If you don't
want
this, you can either navigate Controls collections or try find a sort of
container element (a panel?) that would disable its children when it is
disabled.

Eliyahu

"Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
> Hallo Eliyahu ,
>
> thanks for your answer.
>
> How can I iterate through the controls that were created at design time?> For example when I want to make all available controls invisible or
disabled
> at runtime?
> At the moment I have to call them directly by name. This is very ugly for my
> coding...
>
> Thanks
> Frank
>
>
> "Eliyahu Goldin" <re*************@monarchmed.com> schrieb im Newsbeitrag> news:uH****************@TK2MSFTNGP12.phx.gbl...
> > Frank,
> >
> > Every Control collection contains only immediate children.
> >
> > Eliyahu
> >
> > "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> > news:%2***************@TK2MSFTNGP12.phx.gbl...
> >> Hi,
> >>
> >> I created an ASP.NET page (test.aspx) with some web controls in
> >> GridLayout
> >> (Design time).
> >>
> >> When I look at the collection page.controls by
> >>
> >> foreach (Control ctrl in Page.Controls)
> >> {
> >> ....
> >> }
> >>
> >> then I can not see all the controls on the page.
> >>
> >> Is there a special controls collection for the design time gridlayout> >> controls?
> >>
> >> Best regards
> >> Frank
> >> (newbie)
> >>
> >>
> >
> >
>
>



Nov 19 '05 #7
This will affect only direct children. You need to implement recursion to go
all the way down.

Eliyahu

"Patrick" <Pa*****@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
Hi Frank,

you can iterate through all controls in your page after the Init-Event was
executed. In case you want to set all sub-control unvisible do the following:
public class MyControl : System.Web.UI.Control /* or any other base-class
e.g. System.Web.UI.WebControls.WebControl */

...

void setVisibility(bool visible)
{
foreach (Control ctl in this.Controls)
{
ctl.Visible = visible;
}
}

...

}

Hope that helps
patrick

"Eliyahu Goldin" wrote:
Navigate Controls collections. It is called recursion.

Eliyahu

"Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
news:eU**************@TK2MSFTNGP14.phx.gbl...
But if I want to write a global function that makes all controls on a web page invisible for example then I have to use a generic way of accessing
the
page controls...

I can not imagine that there is no way to do that in the .NET
framework or ASP.NET.
That would really be a strange mistake by Microsoft...

Other opinions?
"Eliyahu Goldin" <re*************@monarchmed.com> schrieb im Newsbeitrag news:uU**************@TK2MSFTNGP09.phx.gbl...
>I must confess that in similar situations I do operate on controls
> individually. Just to add a few extra lines of code is often a better idea
> than spending hours on looking for more elegant solutions. If you
don't > want
> this, you can either navigate Controls collections or try find a sort of > container element (a panel?) that would disable its children when it is > disabled.
>
> Eliyahu
>
> "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> news:%2****************@TK2MSFTNGP14.phx.gbl...
>> Hallo Eliyahu ,
>>
>> thanks for your answer.
>>
>> How can I iterate through the controls that were created at design

time?
>> For example when I want to make all available controls invisible or
> disabled
>> at runtime?
>> At the moment I have to call them directly by name. This is very

ugly for
> my
>> coding...
>>
>> Thanks
>> Frank
>>
>>
>> "Eliyahu Goldin" <re*************@monarchmed.com> schrieb im

Newsbeitrag
>> news:uH****************@TK2MSFTNGP12.phx.gbl...
>> > Frank,
>> >
>> > Every Control collection contains only immediate children.
>> >
>> > Eliyahu
>> >
>> > "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
>> > news:%2***************@TK2MSFTNGP12.phx.gbl...
>> >> Hi,
>> >>
>> >> I created an ASP.NET page (test.aspx) with some web controls in
>> >> GridLayout
>> >> (Design time).
>> >>
>> >> When I look at the collection page.controls by
>> >>
>> >> foreach (Control ctrl in Page.Controls)
>> >> {
>> >> ....
>> >> }
>> >>
>> >> then I can not see all the controls on the page.
>> >>
>> >> Is there a special controls collection for the design time

gridlayout
>> >> controls?
>> >>
>> >> Best regards
>> >> Frank
>> >> (newbie)
>> >>
>> >>
>> >
>> >
>>
>>
>
>


Nov 19 '05 #8
Hallo again,

now everything gets clear. I found following link:
http://aspalliance.com/642

I wonder why nobody could tell me this up to now... ;-)

Thanks to Eliyahu!
Frank

"Eliyahu Goldin" <re*************@monarchmed.com> schrieb im Newsbeitrag
news:eI**************@TK2MSFTNGP10.phx.gbl...
This will affect only direct children. You need to implement recursion to
go
all the way down.

Eliyahu

"Patrick" <Pa*****@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
Hi Frank,

you can iterate through all controls in your page after the Init-Event
was
executed. In case you want to set all sub-control unvisible do the

following:

public class MyControl : System.Web.UI.Control /* or any other base-class
e.g. System.Web.UI.WebControls.WebControl */

...

void setVisibility(bool visible)
{
foreach (Control ctl in this.Controls)
{
ctl.Visible = visible;
}
}

...

}

Hope that helps
patrick

"Eliyahu Goldin" wrote:
> Navigate Controls collections. It is called recursion.
>
> Eliyahu
>
> "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> news:eU**************@TK2MSFTNGP14.phx.gbl...
> > But if I want to write a global function that makes all controls on a web > > page invisible for example then I have to use a generic way of accessing > the
> > page controls...
> >
> > I can not imagine that there is no way to do that in the .NET framework or > > ASP.NET.
> > That would really be a strange mistake by Microsoft...
> >
> > Other opinions?
> >
> >
> > "Eliyahu Goldin" <re*************@monarchmed.com> schrieb im Newsbeitrag > > news:uU**************@TK2MSFTNGP09.phx.gbl...
> > >I must confess that in similar situations I do operate on controls
> > > individually. Just to add a few extra lines of code is often a better > idea
> > > than spending hours on looking for more elegant solutions. If you don't > > > want
> > > this, you can either navigate Controls collections or try find a sort of > > > container element (a panel?) that would disable its children when
> > > it is > > > disabled.
> > >
> > > Eliyahu
> > >
> > > "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> > > news:%2****************@TK2MSFTNGP14.phx.gbl...
> > >> Hallo Eliyahu ,
> > >>
> > >> thanks for your answer.
> > >>
> > >> How can I iterate through the controls that were created at design
> time?
> > >> For example when I want to make all available controls invisible
> > >> or
> > > disabled
> > >> at runtime?
> > >> At the moment I have to call them directly by name. This is very ugly > for
> > > my
> > >> coding...
> > >>
> > >> Thanks
> > >> Frank
> > >>
> > >>
> > >> "Eliyahu Goldin" <re*************@monarchmed.com> schrieb im
> Newsbeitrag
> > >> news:uH****************@TK2MSFTNGP12.phx.gbl...
> > >> > Frank,
> > >> >
> > >> > Every Control collection contains only immediate children.
> > >> >
> > >> > Eliyahu
> > >> >
> > >> > "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> > >> > news:%2***************@TK2MSFTNGP12.phx.gbl...
> > >> >> Hi,
> > >> >>
> > >> >> I created an ASP.NET page (test.aspx) with some web controls in
> > >> >> GridLayout
> > >> >> (Design time).
> > >> >>
> > >> >> When I look at the collection page.controls by
> > >> >>
> > >> >> foreach (Control ctrl in Page.Controls)
> > >> >> {
> > >> >> ....
> > >> >> }
> > >> >>
> > >> >> then I can not see all the controls on the page.
> > >> >>
> > >> >> Is there a special controls collection for the design time
> gridlayout
> > >> >> controls?
> > >> >>
> > >> >> Best regards
> > >> >> Frank
> > >> >> (newbie)
> > >> >>
> > >> >>
> > >> >
> > >> >
> > >>
> > >>
> > >
> > >
> >
> >
>
>
>


Nov 19 '05 #9
That's nice. I've got thanks for an article written by Steve.

That's an ideal example how newsgroup should work.

Question > Directions > Research > Answer.

Eliyahu

"Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
news:eR**************@TK2MSFTNGP12.phx.gbl...
Hallo again,

now everything gets clear. I found following link:
http://aspalliance.com/642

I wonder why nobody could tell me this up to now... ;-)

Thanks to Eliyahu!
Frank

"Eliyahu Goldin" <re*************@monarchmed.com> schrieb im Newsbeitrag
news:eI**************@TK2MSFTNGP10.phx.gbl...
This will affect only direct children. You need to implement recursion to go
all the way down.

Eliyahu

"Patrick" <Pa*****@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
Hi Frank,

you can iterate through all controls in your page after the Init-Event
was
executed. In case you want to set all sub-control unvisible do the

following:

public class MyControl : System.Web.UI.Control /* or any other base-class e.g. System.Web.UI.WebControls.WebControl */

...

void setVisibility(bool visible)
{
foreach (Control ctl in this.Controls)
{
ctl.Visible = visible;
}
}

...

}

Hope that helps
patrick

"Eliyahu Goldin" wrote:

> Navigate Controls collections. It is called recursion.
>
> Eliyahu
>
> "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> news:eU**************@TK2MSFTNGP14.phx.gbl...
> > But if I want to write a global function that makes all controls on a
web
> > page invisible for example then I have to use a generic way of

accessing
> the
> > page controls...
> >
> > I can not imagine that there is no way to do that in the .NET

framework or
> > ASP.NET.
> > That would really be a strange mistake by Microsoft...
> >
> > Other opinions?
> >
> >
> > "Eliyahu Goldin" <re*************@monarchmed.com> schrieb im

Newsbeitrag
> > news:uU**************@TK2MSFTNGP09.phx.gbl...
> > >I must confess that in similar situations I do operate on controls
> > > individually. Just to add a few extra lines of code is often a

better
> idea
> > > than spending hours on looking for more elegant solutions. If you

don't
> > > want
> > > this, you can either navigate Controls collections or try find a

sort of
> > > container element (a panel?) that would disable its children when
> > > it

is
> > > disabled.
> > >
> > > Eliyahu
> > >
> > > "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> > > news:%2****************@TK2MSFTNGP14.phx.gbl...
> > >> Hallo Eliyahu ,
> > >>
> > >> thanks for your answer.
> > >>
> > >> How can I iterate through the controls that were created at

design > time?
> > >> For example when I want to make all available controls invisible
> > >> or
> > > disabled
> > >> at runtime?
> > >> At the moment I have to call them directly by name. This is very

ugly
> for
> > > my
> > >> coding...
> > >>
> > >> Thanks
> > >> Frank
> > >>
> > >>
> > >> "Eliyahu Goldin" <re*************@monarchmed.com> schrieb im
> Newsbeitrag
> > >> news:uH****************@TK2MSFTNGP12.phx.gbl...
> > >> > Frank,
> > >> >
> > >> > Every Control collection contains only immediate children.
> > >> >
> > >> > Eliyahu
> > >> >
> > >> > "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> > >> > news:%2***************@TK2MSFTNGP12.phx.gbl...
> > >> >> Hi,
> > >> >>
> > >> >> I created an ASP.NET page (test.aspx) with some web controls in > > >> >> GridLayout
> > >> >> (Design time).
> > >> >>
> > >> >> When I look at the collection page.controls by
> > >> >>
> > >> >> foreach (Control ctrl in Page.Controls)
> > >> >> {
> > >> >> ....
> > >> >> }
> > >> >>
> > >> >> then I can not see all the controls on the page.
> > >> >>
> > >> >> Is there a special controls collection for the design time
> gridlayout
> > >> >> controls?
> > >> >>
> > >> >> Best regards
> > >> >> Frank
> > >> >> (newbie)
> > >> >>
> > >> >>
> > >> >
> > >> >
> > >>
> > >>
> > >
> > >
> >
> >
>
>
>



Nov 19 '05 #10
Hi Eliyahu,

in case of visibility you do NOT have to implement recursion. When the
parent is not visible childcontrols are displayed neither.

Or am I wrong?
patrick

"Eliyahu Goldin" wrote:
This will affect only direct children. You need to implement recursion to go
all the way down.

Eliyahu

"Patrick" <Pa*****@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
Hi Frank,

you can iterate through all controls in your page after the Init-Event was
executed. In case you want to set all sub-control unvisible do the

following:

public class MyControl : System.Web.UI.Control /* or any other base-class
e.g. System.Web.UI.WebControls.WebControl */

...

void setVisibility(bool visible)
{
foreach (Control ctl in this.Controls)
{
ctl.Visible = visible;
}
}

...

}

Hope that helps
patrick

"Eliyahu Goldin" wrote:
Navigate Controls collections. It is called recursion.

Eliyahu

"Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
news:eU**************@TK2MSFTNGP14.phx.gbl...
> But if I want to write a global function that makes all controls on a web > page invisible for example then I have to use a generic way of accessing the
> page controls...
>
> I can not imagine that there is no way to do that in the .NET framework or > ASP.NET.
> That would really be a strange mistake by Microsoft...
>
> Other opinions?
>
>
> "Eliyahu Goldin" <re*************@monarchmed.com> schrieb im Newsbeitrag > news:uU**************@TK2MSFTNGP09.phx.gbl...
> >I must confess that in similar situations I do operate on controls
> > individually. Just to add a few extra lines of code is often a better idea
> > than spending hours on looking for more elegant solutions. If you don't > > want
> > this, you can either navigate Controls collections or try find a sort of > > container element (a panel?) that would disable its children when it is > > disabled.
> >
> > Eliyahu
> >
> > "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> > news:%2****************@TK2MSFTNGP14.phx.gbl...
> >> Hallo Eliyahu ,
> >>
> >> thanks for your answer.
> >>
> >> How can I iterate through the controls that were created at design
time?
> >> For example when I want to make all available controls invisible or
> > disabled
> >> at runtime?
> >> At the moment I have to call them directly by name. This is very ugly for
> > my
> >> coding...
> >>
> >> Thanks
> >> Frank
> >>
> >>
> >> "Eliyahu Goldin" <re*************@monarchmed.com> schrieb im
Newsbeitrag
> >> news:uH****************@TK2MSFTNGP12.phx.gbl...
> >> > Frank,
> >> >
> >> > Every Control collection contains only immediate children.
> >> >
> >> > Eliyahu
> >> >
> >> > "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> >> > news:%2***************@TK2MSFTNGP12.phx.gbl...
> >> >> Hi,
> >> >>
> >> >> I created an ASP.NET page (test.aspx) with some web controls in
> >> >> GridLayout
> >> >> (Design time).
> >> >>
> >> >> When I look at the collection page.controls by
> >> >>
> >> >> foreach (Control ctrl in Page.Controls)
> >> >> {
> >> >> ....
> >> >> }
> >> >>
> >> >> then I can not see all the controls on the page.
> >> >>
> >> >> Is there a special controls collection for the design time
gridlayout
> >> >> controls?
> >> >>
> >> >> Best regards
> >> >> Frank
> >> >> (newbie)
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>


Nov 19 '05 #11
Very likely, don't remember if I had it somewhere in my applications.

Eliyahu

"Patrick" <Pa*****@discussions.microsoft.com> wrote in message
news:B5**********************************@microsof t.com...
Hi Eliyahu,

in case of visibility you do NOT have to implement recursion. When the
parent is not visible childcontrols are displayed neither.

Or am I wrong?
patrick

"Eliyahu Goldin" wrote:
This will affect only direct children. You need to implement recursion to go all the way down.

Eliyahu

"Patrick" <Pa*****@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
Hi Frank,

you can iterate through all controls in your page after the Init-Event was executed. In case you want to set all sub-control unvisible do the

following:

public class MyControl : System.Web.UI.Control /* or any other base-class e.g. System.Web.UI.WebControls.WebControl */

...

void setVisibility(bool visible)
{
foreach (Control ctl in this.Controls)
{
ctl.Visible = visible;
}
}

...

}

Hope that helps
patrick

"Eliyahu Goldin" wrote:

> Navigate Controls collections. It is called recursion.
>
> Eliyahu
>
> "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> news:eU**************@TK2MSFTNGP14.phx.gbl...
> > But if I want to write a global function that makes all controls on a
web
> > page invisible for example then I have to use a generic way of

accessing
> the
> > page controls...
> >
> > I can not imagine that there is no way to do that in the .NET

framework or
> > ASP.NET.
> > That would really be a strange mistake by Microsoft...
> >
> > Other opinions?
> >
> >
> > "Eliyahu Goldin" <re*************@monarchmed.com> schrieb im

Newsbeitrag
> > news:uU**************@TK2MSFTNGP09.phx.gbl...
> > >I must confess that in similar situations I do operate on
controls > > > individually. Just to add a few extra lines of code is often a

better
> idea
> > > than spending hours on looking for more elegant solutions. If you don't
> > > want
> > > this, you can either navigate Controls collections or try find a

sort of
> > > container element (a panel?) that would disable its children
when it is
> > > disabled.
> > >
> > > Eliyahu
> > >
> > > "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> > > news:%2****************@TK2MSFTNGP14.phx.gbl...
> > >> Hallo Eliyahu ,
> > >>
> > >> thanks for your answer.
> > >>
> > >> How can I iterate through the controls that were created at
design > time?
> > >> For example when I want to make all available controls invisible or > > > disabled
> > >> at runtime?
> > >> At the moment I have to call them directly by name. This is very ugly
> for
> > > my
> > >> coding...
> > >>
> > >> Thanks
> > >> Frank
> > >>
> > >>
> > >> "Eliyahu Goldin" <re*************@monarchmed.com> schrieb im
> Newsbeitrag
> > >> news:uH****************@TK2MSFTNGP12.phx.gbl...
> > >> > Frank,
> > >> >
> > >> > Every Control collection contains only immediate children.
> > >> >
> > >> > Eliyahu
> > >> >
> > >> > "Frank Esser" <Mi*****@nurfuerspam.de> wrote in message
> > >> > news:%2***************@TK2MSFTNGP12.phx.gbl...
> > >> >> Hi,
> > >> >>
> > >> >> I created an ASP.NET page (test.aspx) with some web controls

in > > >> >> GridLayout
> > >> >> (Design time).
> > >> >>
> > >> >> When I look at the collection page.controls by
> > >> >>
> > >> >> foreach (Control ctrl in Page.Controls)
> > >> >> {
> > >> >> ....
> > >> >> }
> > >> >>
> > >> >> then I can not see all the controls on the page.
> > >> >>
> > >> >> Is there a special controls collection for the design time
> gridlayout
> > >> >> controls?
> > >> >>
> > >> >> Best regards
> > >> >> Frank
> > >> >> (newbie)
> > >> >>
> > >> >>
> > >> >
> > >> >
> > >>
> > >>
> > >
> > >
> >
> >
>
>
>


Nov 19 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
5
by: Invalidlastname | last post by:
Hi, I just read the pattern "Design and Implementation Guidelines for Web Clients" from MSDN. Here is my question. In chapter 3,...
4
by: Bas Groeneveld | last post by:
I am developing an ASP.NET application part of which consists of a data entry wizard defined by entries in a data table - ie the controls on each page of the wizard are determined by definitions in...
1
by: seanmayhew | last post by:
Ive got a page with all formatting and layout done with css no tables...It has approximately 60+ controls. All of the controls are in nested panels so i have a something like 6 primary panels and...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
0
by: Learner | last post by:
Hello, We use Master Pages in our website and need a page to be created dynamically. I am not sure where I am missing but I don't see any error and the controls on the page either! Here is my...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
4
by: Goran Djuranovic | last post by:
Hi all, I am experiencing a strange thing happening with a "designer.vb" page. Controls I manually declare in this page are automatically deleted after I drop another control on a ".aspx" page. -...
2
by: =?Utf-8?B?SlQtQVJM?= | last post by:
I have a pretty tricky problem. I have a dynamically built page. I use Page.ParseControls to parse the "entire page" (ASPX file contains only a Page tag). ParseControls is pretty resource...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.