Setting the web control textbox property enabled = FALSE

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
 
T

Teemu Keiski

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
 
G

Gish Smith

I want to skip the tabbing navigation for the text box.
How to do that ? Making read only property is not helpfull.
Gish
 
J

Jason DeFontes

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
 
G

Gish Smith

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.
 

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,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top