简体   繁体   English

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

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

i would like to make a popup dialog box when a user click on a button with user control in asp.net but i keep failing as the dialog box does not open at all. 当用户单击asp.net中具有用户控制的按钮时,我想创建一个弹出对话框,但是由于对话框根本无法打开,所以我一直失败。 here is what i have in my .ascx file: 这是我的.ascx文件中的内容:

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

and here is what i have in my .aspx file: 这是我的.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>

and i have jquery 1.11.0 min in my materpage so what am i doing wrong that the dialog box does not popup? 并且我在materpage中有jquery 1.11.0 min,所以该对话框没有弹出,我在做什么错? thank you in advance 先感谢您

your script should look like: 您的脚本应如下所示:

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

your button should be 您的按钮应该是

<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