Friday, June 7, 2013

javascript don't execute after partial postback

If you are doing partial postback in your page then code on $(document).ready() function will not execute.

You will experience when page loads then your javascript functionality works but after partial postback your code is not working

For resolve this issue you need to write code in following format.

Write general code in SetLocalValues() function which you want to call on $(document).ready() function

var prm = Sys.WebForms.PageRequestManager.getInstance();prm.add_endRequest(function () {//Write your code here//This function executes after partial postback so you need to call $(document).ready() functions code here});
$(document).ready(function () {        SetLocalValues();});
var prm = Sys.WebForms.PageRequestManager.getInstance();prm.add_endRequest(function () {        SetLocalValues();});function SetLocalValues() {//Write your code}
This way i have resolved javascript issue.

Happy Coding!!

No comments:

Post a Comment