TextBox - no value if disabled?

  • Thread starter Thread starter matt
  • Start date Start date
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
 
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 />
 
I'd concur that

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

are the 2 options for handling this.
 
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)...
 
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
 
Back
Top