control disable

  • Thread starter Thread starter Cerebrus99
  • Start date Start date
C

Cerebrus99

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.
 
hi, how to disable the controls in page? thanks

For each myControl in Page.Controls
'want to disable myControl?
Next
 
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
 
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.
 
Back
Top