Showing posts with label jquery. Show all posts
Showing posts with label jquery. Show all posts

Tuesday, October 22, 2013

Browser rendering performance testing - document.createfragment vs jquery-element

After reading the post on browser rendering perforamnce, I tried some performance tests. You can see the test in the following url:










See the chrome result. Doing with jquery element is faster than doing with document.createDocumentFragment. Surprising for me!!

Saturday, April 16, 2011

JavaScript in UpdatePanel

11:13 PM Posted by Unknown , , No comments
Javascript events don't work after the UpdatePanel does a partial page update.

An UpdatePanel completely replaces the contents of the update panel on an update. This means that those events you subscribed to are no longer subscribed because there are new elements in that update panel.

Soln1: Re-subscribe to the events I need after every update. I use $(document).ready() for the initial load, then this snippet below to re-subscribe every update.

var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_endRequest(function() {
// re-bind your jquery events here
});

The PageRequestManager is a javascript object which is automatically available if an update panel is on the page. You shouldn't need to do anything other than the code above in order to use it as long as the UpdatePanel is on the page.

Soln2: Use jQuery's live() event subscriber
$(document).ready(function () {
$("#Button2").live("click", function () {
alert("test");
});

});


Soln3:


where bind is the jquery function

Where bind is the jquery function

Friday, January 22, 2010

JQuery default functions

8:21 PM Posted by Unknown No comments
Following is the jquery default function that is run. we can use this to get the ajaxrequests
function pageLoad() {
            if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) {
                Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(AjaxBegin);      
                Sys.WebForms.PageRequestManager.getInstance().add_endRequest(AjaxEnd);      

            }
        }