Setting the web control textbox property enabled = FALSE

  • Thread starter Thread starter Gill Smith
  • Start date Start date
G

Gill Smith

After setting the web control text box enable property to FALSE makes the
control to loose the data between round trip. I am making sure that the
property - EnableViewState = TRUE.

Same code when the text box Enable property set to TRUE retains the value.
Please advice.

-Gill
 
Hi,

this is related to the HTML standard. Setting Enabled to False on form
control renders it as disabled HTML element (in case of TextBox, <input
type="text" disabled="disabled"...>). And disabled element's value is not
posted with the form. Take a look at:
http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.12.1

By the way, having ViewState enabled or disabled with TextBox has no impact
on TextBox keeping the value, even if it would be disabled as it doesn't use
ViewState to keep the value over postback. More info about that:
http://blogs.aspadvice.com/joteke/archive/2004/03/15/767.aspx
 
I want to skip the tabbing navigation for the text box.
How to do that ? Making read only property is not helpfull.
Gish
 
You could manually store the text value in the ViewState yourself, leave
the textbox disabled, and then manually restore the value from ViewState
on postback.

Or ... you might be able to wire to the textbox's change event, and then
just reset it to the old value there. Not sure about that one.

-Jason
 
Instead of all these steps is there any way I can skip tab stop on the text
box. I want to skip the tab sequense on this control. Disabling the control
is stopping the tab stop but will loose the data between trips.
Thanks for your advice.
 
Back
Top