473,657 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Textbox in ASP

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
Nov 17 '05 #1
2 1185
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
"Martin" <ma**********@a vis.at> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
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

Nov 17 '05 #2
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.
--------------------
Reply-To: "S. Justin Gengo" <sj*****@aboutf ortunate.com>
From: "S. Justin Gengo" <sj*****@aboutf ortunate.com>
References: <#Y************ **@TK2MSFTNGP11 .phx.gbl>
Subject: Re: Textbox in ASP
Date: Tue, 11 Nov 2003 10:27:43 -0600
Lines: 44
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <u6************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: 63.238.248.99
Path: cpmsftngxa06.ph x.gbl!cpmsftngx a09.phx.gbl!TK2 MSFTNGP08.phx.g bl!TK2MSFTNGP10 .
phx.gbl Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1900 81
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

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
"Martin" <ma**********@a vis.at> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
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



Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2117
by: Jonas L | last post by:
Hi, I need to create a textbox which acts as a normal textbox but with the following extra requirements: 1) In-focus color, when the textbox gets focus the backcolor property of the textbox should be set to a, selectable, in-focus color. 2) Out-of-focus color, when the textbox loses focus the backcolor property of the textbox should be set to a, selectable, out-of-focus color.
4
2906
by: Rodrigo DeJuana | last post by:
Howdy, I'm new to this .net stuff and really have little to no training. Im trying to create a new page for a web form, so i have been pretty much jsut coping code. I having some issue with some textboxes not updating when i a hit save. for example I have this code in my aspx.cs file: declared:
0
1810
by: Newasps | last post by:
Hi guys, I have a problem with UpdateCommand Event. In tihs event Ä°'m creating required controls to get that controls' values and also get them. But when I try to get updated values I'm getting the first values for each control. Please help me. Thanks for any help. Bye Ozer And here's my code: Imports System Imports System.Data Imports System.Data.OleDb
7
2114
by: I am Sam | last post by:
I have a DataGrid that is passing information to a stored procedure properly but the parameters aren't being casted properly. I was woundering if anyone can tell me how I should properly cast the following: (TextBox)UserPrefix=(TextBox)e.Item.Cells.Controls; string strUserPrefix=UserPrefix.Text; I keep getting the following error and I don't know why because I have declared the UserPrefix as a textbox using "protected...
11
4541
by: Keith | last post by:
I apologize for those of you who think I'm posting on the same topic. It is not that I don't appreciate all of your comments - and I'm definitely reading them all - but I think I have a differing opinion of how I want to handle the 'user experience' in the application I'm creating. While I know I could allow the user to enter in number and alpha text - in a text box - and then tell them when the execuate a command "This is not numeric data", I...
2
19852
by: Mamatha | last post by:
Hi I want to add an icon to the textbox's text. I don't know how to display icon in textbox in VB.NET. If any one knows please let me know. Thanks in advance. Mamatha
3
2215
by: Brad Rogers | last post by:
All, Being immersed in vb.net and trying CSharp after almost a year I forgot the differences. I like vb fixing the uppercase/lowercase names and seeming to be more flexible to code entry. But while trying to insert a text box to see when a method is used, and putting a counter to bump some variable? The textbox sits there unchanged. I put a breakpoint at the text write
0
2396
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile View I want the form populated from there profile on the sql server. The code to save the profile works fine. But when the user logs back in they data doesn't load back to the form. The multiview is located inside the LoginView's Logged-In View ....
8
36878
by: Marco Pais | last post by:
Hi there. How can I change the background color of a textbox when it gets the focus? I can handle the "Enter" event and do this private void txtDummie_Enter(object sender, EventArgs e) { txtDummie.BackColor=Color.Red; }
1
1619
by: Andy B | last post by:
I have this code: protected void EditEventsWizard_NextButtonClick(object sender, WizardNavigationEventArgs e) { //get the values from the DetailsView TextBox StartTime = (TextBox)EditEventForm.Rows.Cells.Controls; TextBox EndTime = (TextBox)EditEventForm.Rows.Cells.Controls;
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8845
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8622
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5647
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.