如何在ASP.NET UpdatePanel中使用jQuery UI对话框?

时间:2011-10-12 10:51:15

标签: asp.net jquery-ui updatepanel jquery-ui-dialog

这就是我的尝试:

在我的网络表单中:

<div class="demo" style="float: left">
    <div id="dialog" title="Basic dialog">
        <p>This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
    </div>
    <button id="opener">Open Dialog</button>
</div>
<!-- End demo -->

在我的主页中:

<script type="text/javascript">
    // increase the default animation speed to exaggerate the effect
    $.fx.speeds._default = 1000;
    $(function () {
        $("#dialog").dialog({
            autoOpen: false,
            show: "blind",
            hide: "explode"
        });

        $("#opener").click(function () {
            $("#dialog").dialog("open");
            return false;
        });
    });
</script>

正如您所看到的,我只是尝试从jQuery UI官方网站(http://jqueryui.com/demos/dialog/#animated)实现该演示,但它不起作用。

我错过了什么?提前谢谢!

1 个答案:

答案 0 :(得分:1)

有关在加载UpdatePanel后运行javascript的问题,请参阅this question。在UpdatePanel加载之后,您需要定义对话框和按钮单击事件。