Question

I have a page where a user can enter information into text boxes and upon submitting the information is saved to the database and the information is added to a gridview that they can select and edit the records from.

They shouldnt ever, but if they delete a record hit the back button in a browser and then select the record in the gridview again they are going to get out of range error because the record no longer exists in the database.

So I am looking for ideas on how to best keep this scenario from happening. Any suggestions are appreciated and i will be checking frequently to provide any additional information as I know this might be a little vague.

Was it helpful?

Solution

You should always handle the case where a user selects a record that does not exist because of the inherit nature of web applications...the data is stale as soon as the user sees it.

Even if the user just displayed the page for the first time it is possible another user deleted the record just after the results were retrieved.

I would suggest checking to see if the record exists, prompting the user in some manner that the data is stale and refresh the list automatically.

OTHER TIPS

You could temporarily disable the back button with javascript?

http://csharpdotnetfreak.blogspot.com/2009/04/disable-browser-back-button-javascript.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top