一个UpdatePanel的更新后注册动态JavaScript [英] Registering a dynamic javascript after an UpdatePanel's update
问题描述
我有一个动态地创建JavaScript的网页(脚本是pretty静态真的,但它的变量的值是根据用户输入填写)。
I have a page with a dynamicly created javascript (the script is pretty static really, but the value of its variables are filled based on user input).
结果,并采取用户输入控件是更新本身对某些用户intputs的UpdatePanel内。有些userinputs的导致我刚才所说的变量的变化,所以我需要注册一个新的JavaScript。
The result and the controls to take user input is inside an UpdatePanel which updates itself on certain user intputs. Some of these userinputs cause changes in the variables i spoke of earlier so i need to register a new javascript.
问题ofcourse是,只有在UpdatePanel得到更新和脚本registred更新面板添加所以没有新的脚本之外。
The problem ofcourse is that only the updatepanel gets updated and the scripts are registred outside the update panel so no new scripts are added.
你认为什么是最好的做法呢?我可以让这个脚本(和变量)解决了这个活的在的UpdatePanel的我也可以确保在页面完全重新加载的时候,需要发布一个新的JavaScript出现?我已经在页面上的ScriptManager也许能帮助我这个...
What do you think would be best practice now? I could solve this by letting this script (and variables) live inside the updatepanel or i could make sure the page is fully reloaded when the need for posting a new javascript arises? The ScriptManager that i already have on the page might be able to help me with this...
所以我在寻找的人谁不是有类似的问题,并解决他们在一个很好的方式,或者只是一些高见人:)
So i'm looking for someone who either had similar problems and solved them in a nice way, or just someone with some bright ideas :)
推荐答案
为什么不干脆把变量更新面板里面,还是有JavaScript的通过DOM获取值?
Why not just put the variables inside the update panel, or have the JavaScript get the values through the DOM?
这篇关于一个UpdatePanel的更新后注册动态JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!