AjaxAlwaysVisibleCotrolEtander
通过DropDownList确定UpdatePanel的位置
UpdatePanel1.ContentTemplate.ace(AlwaysVisibleControlExtender)
HorizontalOffset:Center//,left,ringht,Center这个位置确定UpdatePanel在页面的上面的位置是水平位置的左侧,右侧,中间
VerticalOffset:Middle://这个位置确定UpdatePanel页面的中间中间位置,top,Middle,Bottom分别是垂直位置的:顶部,中部,下部,
以上两个属性全用才能发挥效果
Default.aspx.cs
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (this.DropDownList1.SelectedValue[0])//00的第一个
{
case '0':
acer.VerticalSide = VerticalSide.Top;//垂直位置的顶部
break; ;
case '1':
acer.VerticalSide = VerticalSide.Middle;//垂直位置的中部
break;
case '2':
acer.VerticalSide = VerticalSide.Bottom;// 垂直的低部
break;
default :
acer.VerticalSide = VerticalSide.Middle;//默认在中部
return;
}
switch (this.DropDownList1.SelectedValue[1])//00的第二个,
{
case '0':
acer.HorizontalSide = HorizontalSide.Left;
break;
case '1':
acer.HorizontalSide = HorizontalSide.Center;
break;
case '2':
acer.HorizontalSide = HorizontalSide.Right;
break;
default :
acer.HorizontalSide = HorizontalSide.Center;
return;
}
}
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body style="text-align: center">
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="showPanel" runat="server" BackColor="#80FFFF" BorderColor="#80FFFF"
BorderWidth="1px" Height="149px" Width="181px">
<br />
<br />
浪曦视频在线<br />
<br />
http://bbs.langsin.com</asp:Panel>
<cc1:AlwaysVisibleControlExtender ID="acer" runat="server" TargetControlID="showPanel" VerticalSide="Middle">
</cc1:AlwaysVisibleControlExtender>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Value="None">默认</asp:ListItem>
<asp:ListItem Value="00">左上</asp:ListItem>
<asp:ListItem Value="01">上中</asp:ListItem>
<asp:ListItem Value="02">右上</asp:ListItem>
<asp:ListItem Value="10">中左</asp:ListItem>
<asp:ListItem Value="11">中中</asp:ListItem>
<asp:ListItem Value="12">中右</asp:ListItem>
<asp:ListItem Value="20">左下</asp:ListItem>
<asp:ListItem Value="21">下中</asp:ListItem>
<asp:ListItem Value="22">右下</asp:ListItem>
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
<div>
</div>
</form>
</body>
</html>