IntroductionThe DragPanelExtender control allows the user to drag controls independently on the web form. It makes user controls dragable. It has two main properties which are used for this. They are DragHandleID and TargetControlID.
<asp:Panel ID="Panel1" runat="server"> <p style="color:Green;">This is simple example of DragPanelExtender control.<br /> You can drag the following panel area at any where on the form. </p> <asp:Panel ID="Panel2" Width="30%" Height="20%" BorderWidth="1px" BorderStyle="Solid" BorderColor="black" runat="server"> <asp:Label ID="Label1" runat="server" Text="Dragable Panel.." ForeColor="Red" Font-Bold="true"></asp:Label> <table> <tr> <td><asp:Label ID="Label2" runat="server" Font-Bold="true" Font-Size="Larger" ForeColor="Red" Text="Name"></asp:Label></td>    <td><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td> </tr> </table> </asp:Panel> <p style="color:Green;">It is simple example of DragPanelExtender control.....</p> </asp:Panel>Step 3 : Go to the ToolBox and add the DragPanelExtender control to the form.Step 4: Set its DragHandleID and TargetControlID property.<asp:DragPanelExtender ID="DragPanelExtender1" DragHandleID="Panel1" TargetControlID="Panel2" runat="server"> </asp:DragPanelExtender>Code on .aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><%@ 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></title> <style type="text/css"> .dragablepanel{ background-color: #FFC0FF; height: 200px; width: 400px; border-bottom-color: black;} </style></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div> <asp:DragPanelExtender ID="DragPanelExtender1" DragHandleID="Panel1" TargetControlID="Panel2" runat="server"> </asp:DragPanelExtender> <asp:Panel ID="Panel1" runat="server"> <p style="color:Green;">This is simple example of DragPanelExtender control.<br /> You can drag the following panel area at any where on the form. </p> <asp:Panel ID="Panel2" Width="30%" Height="20%" BorderWidth="1px" BorderStyle="Solid" BorderColor="black" runat="server"> <asp:Label ID="Label1" runat="server" Text="Dragable Panel.." ForeColor="Red" Font-Bold="true"></asp:Label> <table> <tr> <td><asp:Label ID="Label2" runat="server" Font-Bold="true" Font-Size="Larger" ForeColor="Red" Text="Name"></asp:Label></td>    <td><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td> </tr> </table> </asp:Panel> <p style="color:Green;">It is simple example of DragPanelExtender control.....</p> </asp:Panel> <script type="text/javascript"> function setBodyHeight() { document.body.style.height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight) + "px"; } setBodyHeight(); </script> </div> </form></body></html> Run the application.
OutputYou can Drag the Panel area which contains a Label and TextBox to anywhere on the form.
Hare are some related resources.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: