Wednesday, December 3, 2008

Page Load happens twice in ASP.Net

We are working on a project, in which we are suppose to call a ASPX page from a HTML page. We have a Button in the HTML page, in which we are using javascript to make a call to redirect to ASPX page. We observed that when we try to call the ASPX page, the page load is happening twice.

This was because the method in javascript was not returning a false value on button click event. So when we were redirecting a page load was fired and again since the method has not returned false, once more the page load was getting executed.

So if we return a false from the button click event, then the page load is happening only once.

Hope this solves the issue that most of us are facing of page load being executed twice.

No comments: