如何在用户控件asp.net中使用jquery对话框(弹出)

how to use jquery Dialog (popup) in user control asp.net?

本文关键字:jquery 对话框 弹出 用户 控件 net asp      更新时间:2023-09-26

我想做一个弹出式对话框,当用户点击一个按钮与用户控制在asp.net,但我一直失败的对话框根本不打开。下面是我的。ascx文件中的内容:

<div id="dialog" title="Basic dialog">
<p>some text here</p>
</div>
<script>
$(function () {
    $("#dialog").dialog();
});

下面是我在。aspx文件中的内容:
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
    <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"  type="text/javascript">    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Button ID="btnR" runat="server" Text="Requirements" CssClass="btn btn-info pull-right" />
</asp:Content>

和我有jquery 1.11.0分钟在我的主页那么我做错了什么,对话框没有弹出?提前谢谢大家

你的脚本应该看起来像:

function dialog(){
    $("#dialog").dialog();
};

你的按钮应该是

<asp:Button ID="btnR" runat="server" Text="Requirements" CssClass="btn btn-info pull-right" CausesValidation="false" UseSubmitBehavior="false" OnClientClick="dialog(); return false;" AutoPostBack="false" />