[Resolved]jQuery | Javascript Not Working With UpdatePanel asp.net

jQuery Not Working With UpdatePanel ASP.NET

Most common problem in asp.net UpdatePanel is javascript or jquery implementation problems. This is because of we don't know how to define jquery commands while using UpdatePanel in our web forms.



Reason for not working jQuery in UpdatePanel

As we know, to generate a control using jQuery, we need to define it in the page load event of jQuery or javascript. 

jQuery page load:

 $(document).ready()  

javascript page load:

 windows.onload=function(){  
 }  

Without using UpdatePanel control, this will work as normal. No error will happen, because when a post back event occur from any control, the page will be refreshed and at each time the above page load methods are invoked.

But in the case of UpdatePanel, when an asynchronous post back event occur from any control in the page, the page will not be refreshed and the above page load method will not work. So the jQuery or javascript written in page load becomes unusable.

How to overcome javascript UpdatePanel problem?

To include UpdatePanel in our page we must include ScriptManager control in our page. This ScriptManager in asp.net have a built in javascript page load method that will execute all the time. Which means, the page load method will execute when a synchronous or asynchronous event occur from the page.

ScriptManager method:

 function pageLoad(){  
 //define all page load commands here.  
 }  

Now I think your problem is get resolved. If you have any doubts, more queries just comment here.
[Resolved]jQuery | Javascript Not Working With UpdatePanel asp.net [Resolved]jQuery | Javascript Not Working With UpdatePanel asp.net Reviewed by Biby on 11:16 PM Rating: 5

No comments:

Powered by Blogger.