从代码后面运行JQuery对话框窗口

时间:2013-03-26 13:39:11

标签: asp.net c#-2.0

我想在onClick按钮后面的代码中打开对话框窗口。如何运行脚本?

 <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css" />
    <div id="dialog" title="Alert!!!" style="display: none;">
        <p>
            Lorem Ipsum
        </p>
    </div>

        private void InitializeComponent()
        {
            this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
            this.Load += new System.EventHandler(this.Page_Load);
        }

        private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "script", "$(function() {$('#dialog').dialog('open');});", true);
        }

1 个答案:

答案 0 :(得分:1)

试试这个

ClientScript.RegisterClientScriptBlock(this.GetType(), "script", "<script> $('#dialog').dialog('open');return false;  </script>");