Panel not disabling ??

G

Guest

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
 
G

Guest

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.
:eek:(

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

David Jessee

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

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,585
Members
45,081
Latest member
AnyaMerry

Latest Threads

Top