asp中的jQuery:UpdatePanel

时间:2014-10-01 08:55:10

标签: jquery asp.net updatepanel

我在MultiView内有一个UpdatePanel和一个jQuery,用于转换View内每个MultiView的内容,我的java脚本代码位于UpdatePanel之外1}},问题是我想从我的java脚本里面的代码中得到一个自定义变量,如下所示:

<script>
    function Foo(){
       var a = <%=this.MyVariable%>
       ...
    }
$(document).ready(Foo);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(Foo);
</script>

如果我在我的UpdatePanel中有script,这只会起作用(我的变量会发生变化):

<asp:UpdatePanel>
    <script>
        function Foo(){
           var a = <%=this.MyVariable%>
           ...
        }
    $(document).ready(Foo);
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(Foo);
    </script>
</asp:UpdatePanel>

问题是jQuery执行不正确,它使用最后variable a内容。 如果我使用Google Chrome开发者工具,我可以在Elements标签中看到java脚本使用正确的variable a进行更新,但Sources标签variable a中未更新。

是否有一个我没做过的步骤,或其他方法来实现这个目标?

感谢。

0 个答案:

没有答案
相关问题