Client-side enable/disable

E

Erik J Sawyer

Is there an way, using the built-in functionality of the
web controls, to tie two controls together so that the
value of one will enable/disable another *on the client
side* (no postback).

For example, I'd like to have a textbox that is disabled
by default, but can be enabled by ticking a checkbox on
the form. This seems simple enough that a postback would
be overkill.

Thanks,
Erik J Sawyer
 
J

Jon Paugh

Yes, use javascript. In the onclick event for the checkbox
call javascript to enable/disable your textbox.

You can do the same thing server side thru .net, but of
course it requires a round-trip.

Issue: when you postback will your control still be
disabled (ie. does viewstate still work in this case?)
 
E

Erik J Sawyer

Thanks, I knew that was an option. However, I was hoping
that the Web controls could provide the scripting for me
(much like the validation controls or the autopostback
controls). Looks like that's not the case.

Thanks,
Erik J Sawyer
 
A

Alvin Bruney

you would have to use validation controls and point one control to the
other. I'd go with the javascript idea though for no particular reason
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top