DragPanelExtender 自由拖动控件
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="WebApplication1.WebForm3" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!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>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 500px" >
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Button ID="expbtn" runat="server" Text="展开" onclick="expbtn_Click" />
<asp:Panel ID="Panel1" runat="server" Width="300px" BorderWidth="1"
BorderStyle="Ridge" BackColor="Green" Height="300px">
What is Ajax?
<asp:Panel ID="Panel2" runat="server" Width="300px" BorderStyle="Double" BackColor="Red">
Hello World!
</asp:Panel>
<asp:Panel ID="Panel3" runat="server" Width="300px">
</asp:Panel>
My Name is Tony!
</asp:Panel>
<cc1:DragPanelExtender ID="DragPanelExtender1" runat="server" TargetControlID="Panel1" DragHandleID="Panel2" Enabled="true">
</cc1:DragPanelExtender>
<cc1:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" TargetControlID="Panel1" Collapsed="true" ExpandControlID="expbtn" CollapseControlID="expbtn">
</cc1:CollapsiblePanelExtender>
</div>
</form>
</body>
</html>
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 500px" >
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Button ID="expbtn" runat="server" Text="展开" onclick="expbtn_Click" />
<asp:Panel ID="Panel1" runat="server" Width="300px" BorderWidth="1"
BorderStyle="Ridge" BackColor="Green" Height="300px">
What is Ajax?
<asp:Panel ID="Panel2" runat="server" Width="300px" BorderStyle="Double" BackColor="Red">
Hello World!
</asp:Panel>
<asp:Panel ID="Panel3" runat="server" Width="300px">
</asp:Panel>
My Name is Tony!
</asp:Panel>
<cc1:DragPanelExtender ID="DragPanelExtender1" runat="server" TargetControlID="Panel1" DragHandleID="Panel2" Enabled="true">
</cc1:DragPanelExtender>
<cc1:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" TargetControlID="Panel1" Collapsed="true" ExpandControlID="expbtn" CollapseControlID="expbtn">
</cc1:CollapsiblePanelExtender>
</div>
</form>
</body>
</html>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace WebApplication1
{
public partial class WebForm3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
{
public partial class WebForm3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void expbtn_Click(object sender, EventArgs e)
{
if (expbtn.Text == "展开")
{
CollapsiblePanelExtender1.Collapsed = true;
expbtn.Text = "折叠";
}
else
{
CollapsiblePanelExtender1.Collapsed = false;
expbtn.Text = "展开";
}
}
}
}
{
if (expbtn.Text == "展开")
{
CollapsiblePanelExtender1.Collapsed = true;
expbtn.Text = "折叠";
}
else
{
CollapsiblePanelExtender1.Collapsed = false;
expbtn.Text = "展开";
}
}
}
}


浙公网安备 33010602011771号