0

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. here is what i have in my .ascx file:

<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:

<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? thank you in advance

CodeMonkey
  • 2,511
  • 4
  • 27
  • 38

1 Answers1

0

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" /> 
Matthew Wong
  • 274
  • 1
  • 7
  • <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ReqPopup.ascx.cs" Inherits="IRELBS.Mod.WebUserControl1" %>

    some text here

    – CodeMonkey May 22 '14 at 04:32
  • does the above statement not work? btw you dont need the "$(" in your script – Matthew Wong May 22 '14 at 05:35
  • <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ReqPopup.ascx.cs" Inherits="IRELBS.Mod.WebUserControl1" %>

    some text here

    and still it doesnt work!
    – CodeMonkey May 22 '14 at 06:18
  • wait, where should i use my to import my ascx file exactly?? – CodeMonkey May 22 '14 at 06:20