Monday, 15 December 2014

Dragable ModalPopupExtender In Asp.Net Using AjaxControlToolkit

12/15/2014 - By Pranav Singh 2

This article will show you how you can create a drag able modalpopupextender in asp.net using ajaxcontroltoolkit.  In this we will open the popup message box and drag it on screen by selecting it’s header.


So for this article first we will create a new asp.net application and add the below code in you .aspx page.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="WebApplication1.WebForm4" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!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>Dragable ModalPopupExtender In Asp.Net Using AjaxControlToolkit</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnShowMessage"
            PopupControlID="divMessage" CancelControlID="btnClose" PopupDragHandleControlID="divheader">
        </asp:ModalPopupExtender>
        <table width="100%">
            <tr>
                <td>
                    <asp:Button ID="btnShowMessage" runat="server" Text="Open Popup" />
                </td>
            </tr>
        </table>
        <div runat="server" style="width: 300px;" id="divMessage">
            <table width="300px" border="1">
                <tr>
                    <td>
                        <div style="background-color: Gray; height: 20px; font-weight: bold;" id="divheader">
                            Message</div>
                        <div style="height: 100px;">
                            This is a test message.</div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="btnClose" runat="server" Text="Close" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
    </form>
</body>
</html>

In above code please check the ModalPopupExtender properties

1.       TargetControlI : This is defined for the control id to open the popup when user click on the control.
2.       PopupControlID : This  the is the property which will open the popup.
3.       CancelControlID : This is for closing the popup
4.       PopupDragHandleControlID : In this we will define the control id by using that control we will drage the popup. 

So we have done run the application and check the output.



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

2 comments:

  1. Hi, firstly thanks for the post, maybe the publication has a lot of time, but currently I do not find solution for my problem, I want the modal or the window does not block the mouse events in the background of the web, that is, being able to have the window modal but also to be able to click on the controls of the page that contains the modal window, I would appreciate your help.

    ReplyDelete

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