shahab
shahab

Reputation: 1

Jquery works twice with updatepanel

Hey can you please with me update panels worst behavior of calling my jquery twice :s I have a masterpage where I call some plugins of jquery which are datepicker, uniform and chosen. when the page is loaded it works fine and when update panel is called my functions do not run, I tried

ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), Guid.NewGuid().ToString(), javaScriptFunction, true);

and that worked with datepicker but my forms were basic again. So i added

and that worked perfectly inside the update panel , but the elements which were out side the update panel were called twice and uniform and chosen were doubled :s I am using masterpage so i placed my jquery there so I can not remove code from there and add it again on all pages … How can I stop the doubling of it please help :)

Upvotes: 0

Views: 792

Answers (2)

AssafDamari
AssafDamari

Reputation: 145

Jquery Dom ready will run ones when page first loads. Ms Ajax update panel will not trigger it. If you want jquery code to run on every update you would need to use the ms Ajax events.

Look here for more detils: http://encosia.com/document-ready-and-pageload-are-not-the-same/

Upvotes: 1

Jason
Jason

Reputation: 15931

Check to make sure the jquery source files aren't being included multiple times. Maybe once in the master page, and once in the aspx

Upvotes: 0

Related Questions