分配javascript事件处理程序时触发Asp .Net Linkbutton事件

时间:2013-07-11 11:25:13

标签: jquery asp.net jquery-ui

我在asp .net aspx页面中有一个linkbuton。我在另一个页面中使用jquery ui对话框打开该页面。

从打开页面的代码中,我在新打开的页面中的按钮上放置了一个事件处理程序来关闭页面。

我的问题是,即使没有点击按钮,事件也会触发。我的窗口出现一秒钟然后消失。

这是我的代码:

            if (hdnShowVote.val() == "True" && vote == null) {
            $("#divModal1").dialog({ height: 500, width: 800, modal: true, hide: "fade", closeOnEscape: true, closeText: "", title: "Vote", dialogClass: 'modalBare' })
            $("#ifrVote").attr("src", "CustomerVote.aspx");
            $("#ifrVote").ready(function () {
                $("#ifrVote").contents().find("#btnClose_CustomerVote").click(closeVote());
                alert($("#ifrVote").contents().find("body").length);
            });
        }

为什么会发生这种情况?

1 个答案:

答案 0 :(得分:2)

这是因为您将函数设置为在名为$("#ifrVote")的页面的document.ready上执行

相关问题