By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,890 Members | 1,112 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,890 IT Pros & Developers. It's quick & easy.

control disable

P: n/a
hi, how to disable the controls in page? thanks

For each myControl in Page.Controls
'want to disable myControl?
Next
Feb 13 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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
Feb 13 '06 #2

P: n/a
js,

Have a look at the uper part of this sample.

http://www.vb-tips.com/default.aspx?...6-56e3599238c1

and than instead of that addhanlder

ctr.enabled = false

However in this is probably
me.enabled = false

easier.

Cor
Feb 13 '06 #3

P: n/a
js
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

Feb 13 '06 #4

P: n/a
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


Feb 13 '06 #5

P: n/a
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
Feb 13 '06 #6

P: n/a
js
Thanks Cor.

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:ue*************@TK2MSFTNGP09.phx.gbl...
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

Feb 13 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.