js@someone.com wrote:[color=blue]
> hi, how to disable the controls in page? thanks
>
> For each myControl in Page.Controls
> 'want to disable myControl?
> Next
>
>[/color]
For each myControl in Page.Controls
'want to disable myControl?
myControl.Enabl ed = False
Next
Hi,
I got compile error: "Enable" is not a membre of "System.Web.UI. Control",
Dim myControl as Control
For each myControl in Page.Controls
'want to disable myControl?
myControl.Enabl ed = False
Next
How to fix it? Thanks.
"Chris" <no@spam.com> wrote in message
news:eq5AJIGMGH A.2316@TK2MSFTN GP11.phx.gbl...[color=blue]
> js@someone.com wrote:[color=green]
>> hi, how to disable the controls in page? thanks
>>
>> For each myControl in Page.Controls
>> 'want to disable myControl?
>> Next[/color]
>
> For each myControl in Page.Controls
> 'want to disable myControl?
> myControl.Enabl ed = False
> Next[/color]
Instead of declaring myControl as Control, try declaring it as WebControl
(System.Web.UI. WebControls.Web Control). This class possesses the "Enabled"
property. This of course, assumes that you have only WebControls on your
page, and not HtmlControls etc. Also, not all WebControls support this
property, so you would have to be careful about what all you have on the
page. An alternative may be to put all the controls you want to disable,
into a Panel control and then use "For each myControl in Panel1.Controls "..
The code would then be :
------------------------
Dim myControl as WebControl
For each myControl in Page.Controls
myControl.Enabl ed = False
Next
------------------------
Hope this helps...
Regards,
Cerebrus.
"js" <js@someone.com > wrote in message
news:OksqowKMGH A.552@TK2MSFTNG P10.phx.gbl...[color=blue]
> Hi,
> I got compile error: "Enable" is not a membre of "System.Web.UI. Control",
>
> Dim myControl as Control
> For each myControl in Page.Controls
> 'want to disable myControl?
> myControl.Enabl ed = False
> Next
>
> How to fix it? Thanks.
>
> "Chris" <no@spam.com> wrote in message
> news:eq5AJIGMGH A.2316@TK2MSFTN GP11.phx.gbl...[color=green]
> > js@someone.com wrote:[color=darkred]
> >> hi, how to disable the controls in page? thanks
> >>
> >> For each myControl in Page.Controls
> >> 'want to disable myControl?
> >> Next[/color]
> >
> > For each myControl in Page.Controls
> > 'want to disable myControl?
> > myControl.Enabl ed = False
> > Next[/color]
>
>[/color]
"Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
news:uema1HNMGH A.536@TK2MSFTNG P09.phx.gbl...[color=blue]
> Js,
>
> I see now that it is a webform, that is this tip.
>
> http://www.vb-tips.com/default.aspx?...8-ec5d24c916a6
>
> And than the same as I wrote in the previous message.
>
> Sorry, I did not see it direct,
>
> I hope this helps,
>
> Cor
>[/color]
Comment