Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enable and Disable Textboxes without reposting
Message
From
17/10/2013 11:59:54
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01585738
Message ID:
01585757
Views:
27
>>>I think maybe this task at hand will motivate me to learn jQuery or some other Javascript tool. Here is what I am trying to do:
>>>
>>>An aspx page has a bunch of textboxes and dropdown controls. Initially all controls are disabled. User should be able to click on a button and set all controls to be enabled. I would prefer not to repost the page. So is there a way to change the Enabled attribute of all textboxes without reposting the page?
>>
>>jquery and css selectors
>>
>>$("input").prop('disabled', true);
>>$("input").prop('disabled', false);
>
>Thank you. I will have to study the syntax (I kind of expected that it will come down to learning jQuery).

The important bit is the 'selector' : $("input") selects all 'input' elements (input, textarea and buttons). The remainder sets the disabled property of each.

If you wanted to disable only a subset you could use the class attribute on the relevant elements and use:

$('.className').prop('disabled',true);
(Note the '.' preceding className)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform