I’ve encountered with an difficult bug, that Im not quite sure if there is a good way to solve it.
But I have page(.aspx) which contains a control called widget. The widget appears multiple times in the page. And each widget has alot of js and jquery, some of them reads properties from the control.
The problem I have is that the control does partial postbacks. And the js isn’t being refreshed with the new values.
If I register the js again, then the js is called twice. One containg the right values and one containing the old values. I’ve googled and noticed that it is not possible to remove the added scripts in ScriptManager.RegisterStartupScript.
So to my question. Is there any smart way to not call an old js or to replace it with the new js containing the right values?
I’ve encountered with an difficult bug, that Im not quite sure if there is
Share
From my experience, it’s not really possible. I have ran into this before, and found workarounds, but it always leads to a new bug/issue/problem with using update panels and javascript together.
My suggestion is find a way to not use update panels on code that has javascript attached to it.
Personally, I don’t use update panels AT ALL anymore, because of all the issues, like yours, that I’ve encountered. What I do instead is, create my own MS ASP.NET AJAX controls that implement IScriptControl that talk to web services setup with the [ScriptService] attribute. Having the ScriptService attribute will create client script methods that you can easily call within your javascript code, and handles all the mess for you.