ASP.net referesh problem

  • Thread starter Thread starter Rahul
  • Start date Start date
R

Rahul

We have an ASP.net 2.0 application. The page has a linkbutton that presses
and we make visible a panel that has an update button. He presses the
updated button and the database gets updated. We make the panel invisible
again. But if the user presses the refresh button, the same event handler
gets triggered again and ends up updating the database. This messes up the
data.

Is there a way to avoid this. I know that I can do response.Redirect and
that solves the issue but now the page had to do 2 calls to the server.
There has to be a more elegant way of solve this problem.

Thanks
Rahul
 
There are a number of solutions to this, one of the simplest to implement
(for starters, just to "Get to First Base") is to set a boolean Session
variable that indicates the button was pressed. Just check this value on a
refresh and if it is true, return without any action.
Peter
 

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

Back
Top