Monday, March 26, 2012

Panel not disabling ?

Hi there, I have put some web controls, textboxes and drop down lists, in a
Panel, so that under a certain condition i can disable all fields for input.
I read in Help that disabling a Panel control (enabled=false) will disable
all child controls within it - just what i want. but it just doesnt work.
panMyPanel.Enabled=false; does absolutely nothing. panMyPanel.Visible=false
does hide the whole section, so i know i'm referencing it properly. Why wont
Enabled work? It is not within a datagrid or repeater or anything just in the
form tag. Do I really have to iterate through panMyPanel.Controls (i may
aswell not use the panel)

ThanksI have tested now also. Its working properly for me. Which browser are you
working on. It will not work in downlevel browser. For more detail, refer
this link.
http://msdn.microsoft.com/library/d...bledt opic.asp

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com

"louise raisbeck" <louiseraisbeck@.discussions.microsoft.com> wrote in
message news:78B8F5CD-C4AB-4EDE-92DC-48CA36E787C3@.microsoft.com...
> Hi there, I have put some web controls, textboxes and drop down lists, in
a
> Panel, so that under a certain condition i can disable all fields for
input.
> I read in Help that disabling a Panel control (enabled=false) will disable
> all child controls within it - just what i want. but it just doesnt work.
> panMyPanel.Enabled=false; does absolutely nothing.
panMyPanel.Visible=false
> does hide the whole section, so i know i'm referencing it properly. Why
wont
> Enabled work? It is not within a datagrid or repeater or anything just in
the
> form tag. Do I really have to iterate through panMyPanel.Controls (i may
> aswell not use the panel)
> Thanks
Well I'm stumped then! I'm using IE6. It just ignores the command completely.
Looks like i'll have to iterate through and disable individually.
:o(

incidentally, converting Control to webcontrol in panMyPanel.Controls
returns an error (invalid cast). How do you say for all webcontrols in a
panel? (i really dont want to say for all where name=textbox, dropdown, etc,
painful)

"Saravana" wrote:

> I have tested now also. Its working properly for me. Which browser are you
> working on. It will not work in downlevel browser. For more detail, refer
> this link.
> http://msdn.microsoft.com/library/d...bledt opic.asp
> --
> Saravana
> http://dotnetjunkies.com/WebLog/saravana/
> www.ExtremeExperts.com
>
> "louise raisbeck" <louiseraisbeck@.discussions.microsoft.com> wrote in
> message news:78B8F5CD-C4AB-4EDE-92DC-48CA36E787C3@.microsoft.com...
> > Hi there, I have put some web controls, textboxes and drop down lists, in
> a
> > Panel, so that under a certain condition i can disable all fields for
> input.
> > I read in Help that disabling a Panel control (enabled=false) will disable
> > all child controls within it - just what i want. but it just doesnt work.
> > panMyPanel.Enabled=false; does absolutely nothing.
> panMyPanel.Visible=false
> > does hide the whole section, so i know i'm referencing it properly. Why
> wont
> > Enabled work? It is not within a datagrid or repeater or anything just in
> the
> > form tag. Do I really have to iterate through panMyPanel.Controls (i may
> > aswell not use the panel)
> > Thanks
>
Private Sub DisableControl(c as WebControl)
c.Enabled=flase
dim cc as WebControl
for each cc in c.Controls
DisableControl(cc)
next
End Sub

Then Call DisableControl(panelX)

"louise raisbeck" <louiseraisbeck@.discussions.microsoft.com> wrote in
message news:78B8F5CD-C4AB-4EDE-92DC-48CA36E787C3@.microsoft.com...
> Hi there, I have put some web controls, textboxes and drop down lists, in
a
> Panel, so that under a certain condition i can disable all fields for
input.
> I read in Help that disabling a Panel control (enabled=false) will disable
> all child controls within it - just what i want. but it just doesnt work.
> panMyPanel.Enabled=false; does absolutely nothing.
panMyPanel.Visible=false
> does hide the whole section, so i know i'm referencing it properly. Why
wont
> Enabled work? It is not within a datagrid or repeater or anything just in
the
> form tag. Do I really have to iterate through panMyPanel.Controls (i may
> aswell not use the panel)
> Thanks
Thanks guys, i have used iteration for now to disable all the web controls.

if there are any Microsoft Officials who can explain why Panel.Enabled=false
isnt disabling its child controls (as indicated in msdn help), can you please
let me know. Many thanks.

"David Jessee" wrote:

> Private Sub DisableControl(c as WebControl)
> c.Enabled=flase
> dim cc as WebControl
> for each cc in c.Controls
> DisableControl(cc)
> next
> End Sub
> Then Call DisableControl(panelX)
>
> "louise raisbeck" <louiseraisbeck@.discussions.microsoft.com> wrote in
> message news:78B8F5CD-C4AB-4EDE-92DC-48CA36E787C3@.microsoft.com...
> > Hi there, I have put some web controls, textboxes and drop down lists, in
> a
> > Panel, so that under a certain condition i can disable all fields for
> input.
> > I read in Help that disabling a Panel control (enabled=false) will disable
> > all child controls within it - just what i want. but it just doesnt work.
> > panMyPanel.Enabled=false; does absolutely nothing.
> panMyPanel.Visible=false
> > does hide the whole section, so i know i'm referencing it properly. Why
> wont
> > Enabled work? It is not within a datagrid or repeater or anything just in
> the
> > form tag. Do I really have to iterate through panMyPanel.Controls (i may
> > aswell not use the panel)
> > Thanks
>

0 comments:

Post a Comment