.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 28th, 2009, 05:01 PM
xrum xrum is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 27 xrum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 42 m 42 sec
Reputation Power: 0
Disable all form fields

Hello,

I have this huge form, and when i preview it, i want to disable all fields, so they are read only.

i can do it one by one but it'll take a loong time.

is it possible to somehow loop through the form or through a table and disable everything all at once?


Thanks in advance!

any help would be much appreciated



-------------

sorry, i found it, turns out its much easier then i expected

http://steveorr.net/faq/controltreerecursion.aspx

Reply With Quote
  #2  
Old October 28th, 2009, 05:16 PM
Rictor's Avatar
Rictor Rictor is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 326 Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 18 h 3 m 9 sec
Reputation Power: 213
The easiest way is to just put all the controls into a panel, then you can set "enabled="false" and it will disable everything inside it.

Code:
<asp:Panel ID="Panel1" runat="server" enabled="false">
<asp:Button ID="Button1" runat="server" Text="Button"  />
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
            <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</asp:Panel>

Last edited by Rictor : October 28th, 2009 at 05:19 PM.

Reply With Quote
  #3  
Old November 5th, 2009, 11:06 AM
xrum xrum is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 27 xrum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 42 m 42 sec
Reputation Power: 0
everything works perfect in chrome and Mozilla, but in IE, the labels are also set an disabled (not only the fillable fields), which makes the form really hard to read.

is there a fix or another way around it?

Thanks!

can i maybe set "everything except for labels" to dislabled.

Reply With Quote
  #4  
Old November 5th, 2009, 05:29 PM
Rictor's Avatar
Rictor Rictor is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 326 Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level)Rictor User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 18 h 3 m 9 sec
Reputation Power: 213
Not with the way I showed you to do it, that is the easiest way but it also gives you the least control. With the link you posted in your original, that way would give you the ability to check if it's a label, if so do nothing, else disable the control. Basically teh same theory he uses, but instead of looking for textboxes to color differently, you look for labels to ignore, but disable everything else.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Disable all form fields


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek