473,396 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Disable all controls in...

I have a div which holds controls.
I'm looking for a way to disable all controls but *without* setting each
control enable state.
Same to style>display i'm looking for a disable method.

Do i need a container control for this?
Jan 22 '06 #1
5 2277
Hi Edwin,

Yes, using a Panel WebControl would probably be a good way to solve your
problem.

Groete,
Peter

Peter McMahon
http://www.dotnet.za.net

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dr**********@azure.qinip.net...
I have a div which holds controls.
I'm looking for a way to disable all controls but *without* setting each
control enable state.
Same to style>display i'm looking for a disable method.

Do i need a container control for this?

Jan 22 '06 #2
You can use a container control or make the div a server side control:

<body>
<form id="form1" runat="server">

<div id="div1" runat="server">

<asp:TextBox ID="TextBox1" runat="server" />

<asp:Button ID="Button1" runat="server" />

</div>

</form>

</body>

div1.Visible = false;
--
Andrew Robinson
http://blog.binaryocean.com
"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dr**********@azure.qinip.net...
I have a div which holds controls.
I'm looking for a way to disable all controls but *without* setting each
control enable state.
Same to style>display i'm looking for a disable method.

Do i need a container control for this?

Jan 23 '06 #3
Thanks, will check!

:)
"Peter McMahon" <pe***@nospam.dotnet.za.net> schreef in bericht
news:OM**************@TK2MSFTNGP11.phx.gbl...
Hi Edwin,

Yes, using a Panel WebControl would probably be a good way to solve your
problem.

Groete,
Peter

Peter McMahon
http://www.dotnet.za.net

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dr**********@azure.qinip.net...
I have a div which holds controls.
I'm looking for a way to disable all controls but *without* setting each
control enable state.
Same to style>display i'm looking for a disable method.

Do i need a container control for this?


Jan 23 '06 #4
I did the same, like i said, visible does work, disabling instead.. how?

"Andrew Robinson" <ne****@nospam.nospam> schreef in bericht
news:%2****************@TK2MSFTNGP10.phx.gbl...
You can use a container control or make the div a server side control:

<body>
<form id="form1" runat="server">

<div id="div1" runat="server">

<asp:TextBox ID="TextBox1" runat="server" />

<asp:Button ID="Button1" runat="server" />

</div>

</form>

</body>

div1.Visible = false;
--
Andrew Robinson
http://blog.binaryocean.com
"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dr**********@azure.qinip.net...
I have a div which holds controls.
I'm looking for a way to disable all controls but *without* setting each
control enable state.
Same to style>display i'm looking for a disable method.

Do i need a container control for this?


Jan 23 '06 #5
Edwin,

Only ASP.NET server controls contain the Enabled property. If you are using
all server side controls, you can do the following:

<body>
<form id="form1" runat="server">
<div>
<asp:PlaceHolder ID="PlaceHolder1" runat="server">
<asp:TextBox ID="TextBox1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" />
</asp:PlaceHolder>
</div>
</form>
</body>

in code:

foreach (WebControl control in PlaceHolder1.Controls)
{
control.Enabled = false;
}

If you attempt to use this with an HTML control such as an <IMG> or <INPUT>
tag, you will throw an InvalidCastException.

Hope this helps.

--

Andrew Robinson
http://blog.binaryocean.com

"Edwin Knoppert" <ne**@hellobasic.com> wrote in message
news:43***********************@text.nova.planet.nl ...
I did the same, like i said, visible does work, disabling instead.. how?

"Andrew Robinson" <ne****@nospam.nospam> schreef in bericht
news:%2****************@TK2MSFTNGP10.phx.gbl...
You can use a container control or make the div a server side control:

<body>
<form id="form1" runat="server">

<div id="div1" runat="server">

<asp:TextBox ID="TextBox1" runat="server" />

<asp:Button ID="Button1" runat="server" />

</div>

</form>

</body>

div1.Visible = false;
--
Andrew Robinson
http://blog.binaryocean.com
"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:dr**********@azure.qinip.net...
I have a div which holds controls.
I'm looking for a way to disable all controls but *without* setting each
control enable state.
Same to style>display i'm looking for a disable method.

Do i need a container control for this?



Jan 23 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Scott Emick | last post by:
How can I disable events for the controls on a form? I tried setting the form's enable property to false, but that doesn't stop events from firing on its controls. I need to temporarily disable...
1
by: Bob | last post by:
Does anyone know how to disable javascript in the new Netscape 8 -- for off line testing (like can be done readily with the current MSIE, Firefox or Opera browsers) ? When I try tools -> options...
6
by: | last post by:
hi, how to disable the controls in page? thanks For each myControl in Page.Controls 'want to disable myControl? Next
0
by: Ahmad Jalil Qarshi | last post by:
Hi! I have a problem while developing some webpages.The Problem is that:- How We Can Disable The Controls Of One Web Form From Other Web Form In Asp.net? Explanation:- There Should Be Two...
4
by: Jon Slaughter | last post by:
Is there any method to temporarily disable focus changing?(I assume only method is tab or mouse?) This problem has been tieing me up for a while and nothing seems to work. The only thing that I...
5
by: masterej | last post by:
Developers, Is there any way to disable all checkboxes on a form? I have a form with 160 checkboxes and I want to be able to disable all of them. Is there a way I can do something like this: ...
4
by: tshad | last post by:
I have a page that has about 20 textboxes and dropdowns that I want to disable until a button is pushed. I don't want them to be hidden which I can do with <div visible=false runat=serveror...
8
by: freeskier | last post by:
I have been using the following code to cycle through a subform and disable all textboxes on a form. If a textbox on the form has the focus when this is run I get error "can't disable a control when...
8
by: sebouh181 | last post by:
I am writing to registry using javascript. var wsh = new ActiveXObject("WScript.Shell"); var key = "HKLM\\Software\\Neos\\2.0\\LightMode\\my-script"; wsh.RegWrite (key, 1999, "REG_SZ"); when i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.