TextBox Field Values Disappearing

G

Guest

I'm having a rather vexing problem with my VB.NET ASP.NET application:

Briefly, on rare occasions, when a user of my site presses a button to move
from one record to another, and the Page_Load event fires, all of the TextBox
fields on the page are suddenly, and for no reason, blank.

To explain more fully, from time to time, blank records have been appearing
in the SQL Server database which is administred via my VB.NET Web app. To
determine why, I implemented an event tracker to see what sequence of events
may be causing this to happen. The tracker records the values of certain
TextBox fields on the page during certain events that occur on the server.

To illustrate what I found, assume a record is displayed on the form, and
the user presses a Get Next Record button. The sequence of events is as
follows: Page_Load, then Get_Next_Record_Click. Get_Next_Record_Click then
calls a Save function that saves the current record, then creates a
SqlDataReader object with the next record's data in it, then sends this
SqlDataReader to another function that populates the TextBox fields on the
page with the values from the SqlDataReader.

According to my event tracker, though, on rare occasions, when the Page_Load
event occurs, all of the TextBox fields on my page are inexplicably blank!
Thus when the Save function occurs, it overwrites the data of the current
record with blanks.

Does anyone have any idea why this is happening and/or what to do about it?
 
C

cbrown

You may want to investigate your page_load event. When you call a
button click event, it will cause a postback, when your page loads it
contains no data, and then calls your save() function. It would need
to re-load the data back into the textboxes, save the data, then load
the next record. Otherwise just use validation to dissallow navigation
until the changes are saved.
 
G

Guest

Thank you for your reply.

999 times out of 1000, the sequence of events I described in the OP work
perfectly. 1 time out of 1000, when the Page_Load event occurs, all the
Text_Box fields contain no data. Why does this work 99.9% of the time and
not the of .1%?
 
G

Guest

Come to think of it, this response makes no sense. How do I "re-load" the
data when the TextBox fields that contain the data are blank? From the
database? What about changes my users have made on the page? Discard them?

I think this is a BUG in ASP.NET.

Has anyone else encountered this?
 

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

Top