maxp
maxp

Reputation: 25161

jquery and updatepanel?

I have an updatepanel in ASP.NET that does a partial page refresh.

I've had some success using jQuery's on() method, however $(document).ready(function(){}) is only called during the initial load of a page, rather than after each updatepanel refresh.

I think I could probably trigger it using 'ScriptManager.RegisterStartupScript()' but would prefer a 'cleaner' method. Do any exist?

Upvotes: 3

Views: 199

Answers (2)

Jon Egerton
Jon Egerton

Reputation: 41579

You can register an endRequest handler using a line similar to this (in your Javascript):

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(){})

This will execute after each of your updates.

Upvotes: 2

Royi Namir
Royi Namir

Reputation: 148744

you should use pageLoad() function in JS

function pageLoad()
{
 // put your code when returning from update panel request.
}

Upvotes: 4

Related Questions