Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Double Postback Using IE8

I'm using ASP.NET and I have a save button on webform. When that save button is clicked (ONCE) and I'm using IE8 the event handler is executed twice. If I use compatibility mode it works just fine. In FF everything works just fine. I tested IE8 on both Vista and windows 7 and get the same behavior. IE7 works just fine. Just curious is anyone has had a similar issue.

P.S. I am using an advanced layout system which positions and styles the controls based on a layout definition, so it isn't just a standard throw controls on a page setup.

like image 923
Randall Sutton Avatar asked Aug 28 '09 22:08

Randall Sutton


1 Answers

We are using onserverclick on a button tag instead of using an asp.net button. The solution was to set the type of the button to "button". Before no type was set and I think it was defaulting to submit.

Changed

<button id="button1" runat="server" onserverclick="button1_OnClick" />

To

<button id="button1" runat="server" type="button" onserverclick="button1_OnClick" />

Now I do not get the double post back in IE8.

like image 54
Randall Sutton Avatar answered Nov 10 '22 02:11

Randall Sutton