1

I am using a gridview that uses image pagenation. This seems to perform a double postback each time I click on the image to go to the next page (the first of which causes a SocketException), so to prevent that from occuring I used:

$('#GridUpdatePanel').delegate(':input[type=image]', 'submit', function () {
     return false;
});

This seems to work with IE, making it so only the second (errorless) postback is performed. However, Firefox and Chrome don't seem to even fire this function, meaning they still perform the double postback.

Any ideas? I am currently using jquery 1.6.3

Note that my Gridview is inside an Updatepanel, which is why I have had to use a delegate.

  • 1
    Is this id `GridUpdatePanel` correct ? because actually you need to type `<%=GridUpdatePanel.ClientID%>` – Aristos Nov 04 '12 at 21:50
  • I have a nice answer that can do your job : http://stackoverflow.com/questions/11342546/how-to-prevent-double-submit-with-jquery-in-asp-net-app-with-updatepanels/11342815#11342815 – Aristos Nov 04 '12 at 21:53
  • Hi Aristos - completely forgot about that! It seemed to work for IE anyway but I have changed it accordingly. Unfotunately it seems the problem still remains for Chrome and Firefox. Also, regarding the link you provided - which postback would occur first, the image's submit or the link's onclick? Because it's the onclick that I want to happen (but it appears that the image's submit occurs first...) – QuestionableSounder Nov 04 '12 at 22:30

1 Answers1

0

I discovered the solution - I needed to change 'submit' to 'click':

$('#GridUpdatePanel').delegate(':input[type=image]', 'click', function () {
     return false;
});

I have a feeling it's because I am using an old version of jQuery, but since upgrading is not currently an option for me I will have to stick to this.