Textbox in ASP

M

Martin

How can it be that TextBox.Text has an old value when I read it in to a
variable and I can at the same time see the new value in my browser. I would
guess that it has someting to do with a webpage lifecykle and viewstate but
I cant figure out how. If anyone has experiences like this I would
appreciate some advice. If not I will update this question tomorrow, now I
will go home.

Regards
Martin
 
S

S. Justin Gengo

Martin,

Is it possible that your code is setting the text box value on page load?

If so use:

If Not IsPostBack Then
'---Set textbox text on the first page load only

End If

My guess is that you may be overwriting the new value when the client posts
back to the server.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
M

Mike Moore [MSFT]

Hi Martin,

Justin's suggestion sounds very good. If that didn't solve your problem,
then I suggest debugging. I think that some code is changing the value and
debugging can help you find that code.

First, look through the code to see if you can spot the error. Look at your
server and client code (java script). Then choose break points and debug
your application as described in these articles. If you see that the value
changes, then move your break points to zero in on the line of code causing
the problem.

316726 HOW TO: Debug an ASP.NET Web Application
http://kb/article.asp?id=Q316726

317699 HOW TO: Debug Client-Side Script in Visual Basic .NET
http://kb/article.asp?id=Q317699

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.


--------------------
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top