Registering dynamic javascript after updating UpdatePanel

I have a page with dynamically generated javascript (the script is pretty static, but the value of its variables is populated based on user input).

The result and the controls necessary for user input are located inside the UpdatePanel, which is updated when certain user entries occur. Some of these userinputs cause changes to the variables that I mentioned earlier, so I need to register a new javascript.

The problem is that only the updated panel is updated, and scripts are registered outside the update panel, so new scripts are not added.

What do you think will be best now? Could I solve this by letting this script (and variables) live inside the update panel, or can I make sure the page is completely reloaded when it becomes necessary to publish new javascript? The ScriptManager that I already have on the page can help me with this ...

So, I'm looking for someone who either had similar problems, and they solved them beautifully, or just someone with bright ideas :)

+6
javascript updatepanel
source share
3 answers

Why not just put the variables inside the update panel or get JavaScript through the DOM?

0
source share
+3
source share

I got better with ScriptManager.RegisterStartupScript than with ScriptManager.RegisterClientScriptBlock . You can do it.

+3
source share

All Articles