tags:

views:

775

answers:

5
A: 

I haven't used ASP.NET in a few years, but you should wrap your "do this on postback" code in Page.IsPostBack:

if(IsPostBack) {
    //do your data-saving code...
}

MSDN link

matt b
That won't work because they're re-posting a post-back.
Mufasa
+3  A: 

You could try using the Post/Redirect/Get pattern. Basically instead of letting the postback send the data, redirect to the page. That way, if a user refreshes, s/he is refreshing the GET command rather than the POST.


Sorry.. missed the UpdatePanel piece. Make sure that your submit button is also within that UpdatePanel. A page refresh would not affect your AJAX call, but when the button is outside the panel, it's doing a regular postback so you would be sending the Add Request again.

Wayne
@Wayne Wouldn't this defeat the whole purpose of the AJAX? Wouldn't the entire page refresh if I did a redirect?
mattruma
This would defeat the use of AJAX
Mitchel Sellers
I'll give this a whirl!
mattruma
+1  A: 

There's a nice article on the subject here.

ballpointpeon
A: 

@matt b - even if he put everything in that bracket, i think the page will still execute the comment insert when the user refreshes. maybe try using "on duplicate update" clause in your sql?

marduk
A: 

I am having problems with jpeg files exported from Lightroom 2.2 http://www.ebook-search-queen.com/ebook/ligh/lightroom-2.2.all.html . I dont think ImageGetExifMetadata working properly for LR images. I can see the all exif information with a different programs. One of the errors:"Element Focal Plane Y Resolution is undefined in a CFML structure referenced as part of an expression. ". "Element Focal Plane Y Resolution" is there but CF can't read it. I have tried all sorts with no luck.On the other hand it works for non LR jpg images. Any ideas?