textbox ignores disabled viewstate?

P

PJ6

I have a textbox control where OnKeyPress of Enter, a few hidden field
values are set and then form[0] is submitted from JavaScript. The page
reloads, and this textbox is then repopulated with data that may be
different than what the user just entered. Well, I'm having a problem with
this textbox getting its value set after the page Load event to the text the
user just entered - even when I've explicitly disabled ViewState! I found a
way around this by changing the ID of the TextBox every time the page loads
using a GUID... but is this really necessary? I must have missed something -
there must be a way of preventing the browser from blithely ignoring my
request not to record viewstate, right?

Paul
 
S

Steve C. Orr [MVP, MCSD]

The textbox doesn't use ViewState to store its value. Instead its a simple
post in for Form collection.
Try setting the text property to a value of your choice in the Render event.
 
P

PJ6

I had set AutoPostBack = False, too. Guess that doesn't matter though.

I think I'll override the Text property and just prevent it from being set.
I'll just have to remember not to try to set it the normal way in my own
code.

Thanks,
Paul

Steve C. Orr said:
The textbox doesn't use ViewState to store its value. Instead its a
simple post in for Form collection.
Try setting the text property to a value of your choice in the Render
event.




PJ6 said:
I have a textbox control where OnKeyPress of Enter, a few hidden field
values are set and then form[0] is submitted from JavaScript. The page
reloads, and this textbox is then repopulated with data that may be
different than what the user just entered. Well, I'm having a problem with
this textbox getting its value set after the page Load event to the text
the user just entered - even when I've explicitly disabled ViewState! I
found a way around this by changing the ID of the TextBox every time the
page loads using a GUID... but is this really necessary? I must have
missed something - there must be a way of preventing the browser from
blithely ignoring my request not to record viewstate, right?

Paul
 

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,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top