我的jQuery对话框按钮如何执行我的代码?

时间:2012-06-28 18:50:48

标签: jquery asp.net dialog jquery-ui-dialog server-side

enter code here我的jquery ui对话框包含一个iframe,并且可以选择两个按钮,即应用和关闭。 这是我的javascript生成这个:

$(function () {
    $(".btn").click(function() {
        var $this = $(this);
        $('<iframe id="PDFDialog"  frameborder="0" src="' + this.href + '" />').dialog({
            title: ($this.attr('title')) ? $this.attr('title') : 'External Site',
            autoOpen: true,
            width: 700,
            height: 600,
            modal: true,
            resizable: true,
            buttons: {
                Apply: function () {
                    $("#<%= applyHiddenBtn%>").click();                        
                    $(this).dialog("close");
                },
                Close: function () {
                    $(this).dialog("close");
                }
            }
        }).width(650).height(550);
        return false;
    });
});

我不确定如何执行我已准备好对话框按钮“应用”的代码。作为尝试我有另一个服务器按钮<asp:Button runat="server" ID="applyHiddenBtn" OnClick="applyHiddenBtn_Click"/>,我尝试同时开火。

目标是解雇这个:

Sub applyHiddenBtn_Click(sender As Object, e As EventArgs)
    lblTest1.Text = "HelloWorld!!!1!"
End Sub

请帮忙吗?

1 个答案:

答案 0 :(得分:0)

以下内容将对执行POST处理程序的服务器执行applyHiddenBtn

__doPostBack('applyHiddenBtn', '');

http://weblogs.asp.net/yousefjadallah/archive/2010/06/27/insure-that-dopostback-function-implemented-on-the-page.aspx