Friday 7 November 2008

JQuery and ASP.NET Ajax ready and pageLoad Solution

I had a problem the other day with the JQuery ready function not firing on an Aspc post back. I found this useful article

The problem seems to be that the jQuery ready function is not called on an async postback. The pageLoad() ASP.NET ajax method is called however.

It seems that ASP.NET ajax and jQuery don’t get along together when it comes to the DOM load event, and ASP.NET ajax takes preference to the jQuery ready function.

So in short replace all jQuery: $(document).ready() instances in your code with function pageLoad(). This I think is a more elegant solution then intercepting the end_request event and altering the master page.

No comments: