TextBox - no value if disabled?

M

matt

hello,

is it expected behavior (in 1.1) for a disabled=true textbox to *not*
maintain its value upon postback?

if so, this is disappointing. often times in my app i need to "lock"
textboxes, reserving them for automated javascript entry only, not
manual. but id still like to pick up their values on postback.

i have work arounds i can employ, but i wanted to confirm this
behavior.


thanks,
matt
 
A

Arthur Dent

Is it something that the user is supposed to see? Or not.

Usually if i have values i want to hide from the user, i will use the
following:
<input type=""hidden" id="hdnMyValue" runat="server" >
(in 2.0 there is actually an asp Hidden control type)
If you do want the user to see the box, then instead of disabling it, you
could set it to be ReadOnly.

How are you coding your textbox? Are your using
<asp:textbox id=txtMyBox runat=server enabled=false />
or are you using
<input type=textbox disabled=true />
 
S

sloan

I'd concur that

ReadOnly on the textbox
and/or a
<asp:hidden>

are the 2 options for handling this.
 
P

Patrice

Yes, this is a browser side behavior (AFAIK likely accross most browsers).
The (bad ?) idea is likely that if the control is disabled you can't change
the value and consequently there is no need to post this (unchanged) value
to the server (probably designed this way back to low bandwidth/ no
javascript days)...
 
M

matt

Patrice said:
Yes, this is a browser side behavior (AFAIK likely accross most browsers).
The (bad ?) idea is likely that if the control is disabled you can't change
the value and consequently there is no need to post this (unchanged) value
to the server (probably designed this way back to low bandwidth/ no
javascript days)...

ah, this is what i was looking for. as i mentioned i have work arounds,
but i wanted to make sure this was unchangeable behavior.


thanks,
matt
 

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

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top