Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I used this
http://jqueryui.com/dialog/#animated[^]

to show Animated Dialog Box
C#
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
    $(function() {
    $('#<%=dialog.ClientID %>').dialog({
            autoOpen: false,
            show: {
                effect: "blind",
                duration: 1000
            },
            hide: {
                effect: "explode",
                duration: 1000
            }
        });
        $('#<%=opener.ClientID %>').click(function() {
        $('#<%=dialog.ClientID %>').dialog("open");
        });
    });
</script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<div id="dialog"  runat="server" title="Basic dialog">
<p>This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
 <asp:Button ID="opener" runat="server" Text="Button" />
</asp:Content>


but nothing happend on my Screen .did i missed anything ?


Edited:

this is my page Source form firebug Script tab

HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>

</title>

 <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script type="text/javascript">
    $(function() {
    $('#ctl00_ContentPlaceHolder1_dialog').dialog({
            autoOpen: false,
            show: {
                effect: "blind",
                duration: 1000
            },
            hide: {
                effect: "explode",
                duration: 1000
            }
        });
        $('#ctl00_ContentPlaceHolder1_opener').click(function() {

        $('#ctl00_ContentPlaceHolder1_dialog').dialog("open");
        });
    });
</script>
</head>
<body>
    <form name="aspnetForm" method="post" action="Default2.aspx" id="aspnetForm">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNTA5NTQwODU3ZGTjHXEnTCPZkag2gXKOdIjs9hJlOg==" />
</div>

<div>

	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgKHjK/pDQKC1MeGC8nJ+J/ArkUcMIPb9FpPaV9jjboo" />
</div>
    <div>
        
   
    <div id="ctl00_ContentPlaceHolder1_dialog" title="Basic dialog">
<p>This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>

    <input type="submit" name="ctl00$ContentPlaceHolder1$opener" value="Button" id="ctl00_ContentPlaceHolder1_opener" />

 



    </div>
    </form>
</body>
</html>
Posted
Updated 14-Dec-14 17:31pm
v3
Comments
Check the Developer Tool Console first.
King Fisher 12-Dec-14 13:20pm    
didn't sleep?
Not yet. Tell me.
King Fisher 12-Dec-14 23:53pm    
No errors but some warnings
King Fisher 12-Dec-14 23:58pm    
I see something flicking at the Div but does't get the dialog box i checked with the alert('message'); and its worked .i thing Error might be at css

I just created one fiddle - http://jsfiddle.net/taditdash/t614Lc7o/[^]

Just replaced asp Button with input button. Used jQuery 1.9.1 and jQuery 1.9.2. And it's working.

You should start debugging the code. But the files you used, I guessed the exact example is in jQuery official site. So, it should work.

Do one thing. Just put a debugger inside the click event by writing debugger; and then you will be able to debug the code inside the Firebug. Press F10 and go line by line.


Updated:


JavaScript
$('#<%=opener.ClientID %>').click(function () {
$('#<%=dialog.ClientID %>').dialog("open");
return false;
});
 
Share this answer
 
v2
Comments
King Fisher 13-Dec-14 12:05pm    
hi Tadit ,I'm getting this Error
TypeError: $(...).dialog is not a function
$("#dialog").dialog({
That means it cannot able to find the dialog function. Have you added the jQuery reference? You can see in the script window of developer tool, whether it is added or not.
King Fisher 13-Dec-14 13:23pm    
sorry
Haha. Please accept the answer then. Thanks. :)
King Fisher 14-Dec-14 3:29am    
you can find the reference link in my Question ,I have the Link
You can't use .ClientID in javascript. You need to give it the actual ID. Since you are using master pages the ID can get messed up.

Things I did:
Corrected javascript ids.
Added ClientIDMode="Static" to your button 'opener'.
Remove the runat tag from the 'dialog' div this isn't necessary.

VB
<asp:content id="Content1" contentplaceholderid="head" runat="Server" xmlns:asp="#unknown">
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
    $(function() {
    $('#dialog').dialog({
            autoOpen: false,
            show: {
                effect: "blind",
                duration: 1000
            },
            hide: {
                effect: "explode",
                duration: 1000
            }
        });
        $('#opener').click(function() {
        $('#dialog').dialog("open");
        });
    });
</script>
 
</link></link></asp:content>
<asp:content id="Content2" contentplaceholderid="ContentPlaceHolder1" runat="Server" xmlns:asp="#unknown">
 
<div id="dialog" title="Basic dialog">
<p>This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
 <asp:button id="opener" runat="server" text="Button" clientidmode="Static" />
</asp:content>
 
Share this answer
 
Comments
Richard Deeming 12-Dec-14 11:56am    
You can use .ClientID inside a <%= ... %> block.
He can use ClientID. No issue will happen as long as the script is inside the same page and not in any external js file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900