Textbox in ASP

  • Thread starter Thread starter Martin
  • Start date Start date
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
 
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
 
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.


--------------------
 
Back
Top