Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox retaining old values

Status
Not open for further replies.

aradia926

MIS
Jul 11, 2005
29
US
This is really weird and I just can't seem to get it figured out.

I have a page with a formview control. When users insert a record, they type a name into the very first textbox in the form and click a search button. This name is passed via querystring to a search page. After a search is performed on the search page to locate the appropriate name, the user is redirected back to the original form which is now partially populated by the search results. The user continues to enter the record and saves it.

Now, when the user goes to enter another record and types a name into the textbox, the querystring brings the value that was entered into the textbox for the previous record entry, not the current one.

After each save I reset the value of the name textbox to name.text = nothing but the textbox continues to remember the previous value.

I'm not experiencing this problem anywhere else.

Does anybody have any ideas?
 
aradia926: You might try clearing with a statement like:
name.text = "" (empty string)
Also, be careful with terms such as "name"; could end up inadvertently using machine language. Perhaps name it "txtName", or if a Label, "lblName", etc.

I assume in your redirect to the Search page you are doing something like:

Response.Redirect("....?myName=" & Name.Text & "&other=" ...)

That is, transferring the textbox's content into the QS for the redirect. This should pick up the current text value of the textbox. Also, in the Page_Load event you can clear the Name.Text at that time -- are you using javascript at all?

It could be the previous page is sitting in Cache and you're not reloading it -- from the Search Page you should redirect to the original page and carry all QS value to and from.

I would abandon the partial populated bit, and carry all values in a QS to the Search page, and Response.Redirect back to the orginal page loading up all variable in the Page Load event.

You'll proably get a few more ideas on this; just a couple of things to consider.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top