Refresh repeats last action

  • Thread starter Thread starter kj12345
  • Start date Start date
K

kj12345

I am writing a content management system where users can remove and
edit data. I have a datagrid with a 'remove' button on each row. If a
user clicks this (or 'add new', or 'edit') it works fine. However, if
they then press refresh on their browser, .NET attempts to repeat the
last action, which really messes things up. Is there a way to signal
NET that, for example, an OnClick event shouldn't occur again upon
refresh? Thanks.
 
This is a browser feature. It repeats the last postback whatever it was. You
can't get browser to change it's behavior. You should rather implement a
sort of protection against this in your code.

Eliyahu
 
What about my "add a new record" button, though? It's perfectly
reasonable for someone to add two records in a row, so it seems to be
nearly indistiguishable from clicking "refresh"? (Thanks for the
response anyway, that clarifies things.)
 
Understand. May be a timestamp could help? When adding a record, provide a
timestamp in a hidden field and store it on the server. Check the timestamp
in every new "add record" request against the previous one.

Eliyahu
 

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