Hi Js,
Instead of declaring myControl as Control, try declaring it as WebControl
(System.Web.UI.WebControls.WebControl). 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.Enabled = False
Next
------------------------
Hope this helps...
Regards,
Cerebrus.
"js" <js@someone.com> wrote in message
news:Ok*************@TK2MSFTNGP10.phx.gbl...
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.Enabled = False
Next
How to fix it? Thanks.
"Chris" <no@spam.com> wrote in message
news:eq**************@TK2MSFTNGP11.phx.gbl... js@someone.com wrote: hi, how to disable the controls in page? thanks
For each myControl in Page.Controls
'want to disable myControl?
Next
For each myControl in Page.Controls
'want to disable myControl?
myControl.Enabled = False
Next