簡體   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