469,647 Members | 1,769 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

control disable

hi, how to disable the controls in page? thanks

For each myControl in Page.Controls
'want to disable myControl?
Next
Feb 13 '06 #1
6 1334
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
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
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
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
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
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.

Similar topics

2 posts views Thread by Eric | last post: by
reply views Thread by Robert Ladd | last post: by
1 post views Thread by AndrewR | last post: by
2 posts views Thread by Andre Ranieri | last post: by
reply views Thread by Kumar R | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.