Sunday, 31 August 2014

jQuery Dialog Box Open On Button Click In Asp.Net

8/31/2014 - By Pranav Singh 0

This article will show you how you can open a jQuery Dialog Box on button click in asp.net using jQuery. In this I have used jQuery UI to open the dialog box.


So for this article first we will create a new asp.net application and add an .aspx page and add the below library reference in header of the page.

<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.js"></script>

 Now here is the complete code of the page.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DialogBox.aspx.cs" Inherits="ProjectDemo_Asp.et.DialogBox" %>

<!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 runat="server">
    <title>jQuery Dialog Box Open On Button Click In Asp.Net</title>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
    <script>
        $(function () {
            $("#divdialogbox").dialog({
                autoOpen: false
            });

            $("#opener").click(function () {
                $("#divdialogbox").dialog("open");
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div id="divdialogbox" title="Basic dialog" style="font-size:60%">
            <p>
                This is an dialog which will display information</p>
        </div>
        <input type="button" id="opener" value="Open Dialog" />
    </div>
    </form>
</body>
</html>

In above code I have a declared I have use dialog function to open the dialog box. After that I have defined the height and width of the dialog box.

Now we have done run the page and check the output.

DOWNLOAD

About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Global Classified : Connectseekers.com
© 2014 aspdotnet-pools.com Designed by Bloggertheme9.
back to top