Prevent multple inserts after browser refresh?
-
Each new record is inserted withn a unique id. The problem is that following insert if the user hits the browser refresh button the same record gets inserted albeit with a new id. How do I stop this happening? Thanks Majella
Is your code in page load. Can you put an if not isPostBack around it?
-
Is your code in page load. Can you put an if not isPostBack around it?
I'm not doing it within page load. I'm doing it with another event handler InsertRecord_Click. I've tried if not IsPostBack within that event i.e. if (!IsPostBack) { SqlDataSource1.Insert(); }; but IsPostBack always comes back false so the record never gets inserted. This strikes me as a common problem which lots of programmers must have encountered - or maybe they haven't noticed! I know that Dino Esposito has set out some advice on how to deal with this problem specifically at http://www.dotmugs.ch/events/event.aspx?eid=17 but I can't get on to it because I don't have a Swiss address. Thanks Majella
-
Each new record is inserted withn a unique id. The problem is that following insert if the user hits the browser refresh button the same record gets inserted albeit with a new id. How do I stop this happening? Thanks Majella
You could have a wee look at this: http://www.joel.net/code/refresh_capture.aspx