I have a jquery plugin and I noticed when I a postback my plugin is like gone. I know this because if it was working I would see a image of the stuff. It is in the update panel. So does javascript not get reloaded when using a update panel?
You have to rebind the jquery. its the same as if you had done a replacewith in jquery. The html is replaced and all bindings on the html are replaced.
There's probably an easier way. I have a custom ajaxtoolkit extender in my one update panel and I load my jquery in the intialize function of the behavior.js. It works flawlessly though.
Ok well I am just going to stick to jquery then even though what I was doing with the jquery for that particular part had nothing to do with ajax. Anyways I pretty much figured out how to everything I need to do with jquery.
chobo2
Member
16 Points
615 Posts
Update panel kills my jquery script
Mar 02, 2009 02:50 AM|LINK
Hi
I have a jquery plugin and I noticed when I a postback my plugin is like gone. I know this because if it was working I would see a image of the stuff. It is in the update panel. So does javascript not get reloaded when using a update panel?
Danny117
Star
10576 Points
1837 Posts
Re: Update panel kills my jquery script
Mar 02, 2009 02:31 PM|LINK
You have to rebind the jquery. its the same as if you had done a replacewith in jquery. The html is replaced and all bindings on the html are replaced.
stmarti
Contributor
4602 Points
974 Posts
Re: Update panel kills my jquery script
Mar 02, 2009 02:37 PM|LINK
You need ScriptManager.RegisterStartupScript to run your jquery script each time when the updatepanel updating.
Also read:
ASP.NET AJAX > Overview > ASP.NET AJAX Client Life-Cycle Events
Danny117
Star
10576 Points
1837 Posts
Re: Update panel kills my jquery script
Mar 02, 2009 09:18 PM|LINK
There's probably an easier way. I have a custom ajaxtoolkit extender in my one update panel and I load my jquery in the intialize function of the behavior.js. It works flawlessly though.
gt1329a
All-Star
15339 Points
2497 Posts
ASPInsiders
MVP
Re: Update panel kills my jquery script
Mar 04, 2009 09:01 PM|LINK
A guide to combining jQuery and ASP.NET: jQuery for the ASP.NET developer
Lance Zhang...
All-Star
33091 Points
2361 Posts
Re: Update panel kills my jquery script
Mar 05, 2009 06:47 AM|LINK
HI chobo2
Actually, we don't suggest you use other AJAX frameworks and ASP.Net Ajax on the same site or on the same page.
Because of the architecture of these two Ajax client libraries is different. If you mix them up together, the different architectures may generate JavaScript conflict.
So, in this scenario, I would like to suggest you try to read the following articles which talk about ASP.NET and JQuery working together:
jQuery effects not working after UpdatePanel Asynchronous request is over
http://imak47.wordpress.com/2008/10/18/jquery-effects-not-working-after-updatepanel-asynchronous-request-is-over/
Integrating jQuery with ASP.NET
http://ferry.ferryandtheria.com/?p=3
3 mistakes to avoid when using jQuery with ASP.NET AJAX
http://encosia.com/2008/06/05/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax/
Thanks
chobo2
Member
16 Points
615 Posts
Re: Update panel kills my jquery script
Mar 05, 2009 09:45 PM|LINK
Ok well I am just going to stick to jquery then even though what I was doing with the jquery for that particular part had nothing to do with ajax. Anyways I pretty much figured out how to everything I need to do with jquery.