Refresh repeats last action

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.
 
E

Eliyahu Goldin

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
 
K

kj12345

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.)
 
E

Eliyahu Goldin

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

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,253
Latest member
BlytheFant

Latest Threads

Top