繁体   English   中英

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

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

当用户单击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>

并且我在materpage中有jquery 1.11.0 min,所以该对话框没有弹出,我在做什么错? 先感谢您

您的脚本应如下所示:

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" /> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM