div>
< asp:UpdatePanel ID ="UpdatePanel1" runat ="server" >
< ContentTemplate >
< asp:Panel ID ="Panel1" runat ="server" Width ="161" Height ="127"
BorderColor ="#C2C2C2" BorderStyle ="Dashed" BorderWidth ="1px" >
< br />
< br />
学习AJAX < br />
就去playaspx.com </ asp:Panel >
< cc1:AlwaysVisibleControlExtender ID ="AlwaysVisibleControlExtender1"
runat ="server" TargetControlID ="Panel1" 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 >
< asp:UpdatePanel ID ="UpdatePanel1" runat ="server" >
< ContentTemplate >
< asp:Panel ID ="Panel1" runat ="server" Width ="161" Height ="127"
BorderColor ="#C2C2C2" BorderStyle ="Dashed" BorderWidth ="1px" >
< br />
< br />
学习AJAX < br />
就去playaspx.com </ asp:Panel >
< cc1:AlwaysVisibleControlExtender ID ="AlwaysVisibleControlExtender1"
runat ="server" TargetControlID ="Panel1" 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 >
protected
void
DropDownList1_SelectedIndexChanged(
object
sender, EventArgs e)
{
switch (DropDownList1.SelectedValue[ 0 ].ToString())
{
case " 0 " :
AlwaysVisibleControlExtender1.HorizontalSide = HorizontalSide.Left;
break ;
case " 1 " :
AlwaysVisibleControlExtender1.HorizontalSide = HorizontalSide.Center;
break ;
case " 2 " :
AlwaysVisibleControlExtender1.HorizontalSide = HorizontalSide.Right;
break ;
default :
AlwaysVisibleControlExtender1.HorizontalSide = HorizontalSide.Center;
break ;
}
switch (DropDownList1.SelectedValue[ 1 ].ToString())
{
case " 0 " :
AlwaysVisibleControlExtender1.VerticalSide = VerticalSide.Top;
break ;
case " 1 " :
AlwaysVisibleControlExtender1.VerticalSide = VerticalSide.Middle;
break ;
case " 2 " :
AlwaysVisibleControlExtender1.VerticalSide = VerticalSide.Bottom;
break ;
default :
AlwaysVisibleControlExtender1.VerticalSide = VerticalSide.Middle;
break ;
}
}
{
switch (DropDownList1.SelectedValue[ 0 ].ToString())
{
case " 0 " :
AlwaysVisibleControlExtender1.HorizontalSide = HorizontalSide.Left;
break ;
case " 1 " :
AlwaysVisibleControlExtender1.HorizontalSide = HorizontalSide.Center;
break ;
case " 2 " :
AlwaysVisibleControlExtender1.HorizontalSide = HorizontalSide.Right;
break ;
default :
AlwaysVisibleControlExtender1.HorizontalSide = HorizontalSide.Center;
break ;
}
switch (DropDownList1.SelectedValue[ 1 ].ToString())
{
case " 0 " :
AlwaysVisibleControlExtender1.VerticalSide = VerticalSide.Top;
break ;
case " 1 " :
AlwaysVisibleControlExtender1.VerticalSide = VerticalSide.Middle;
break ;
case " 2 " :
AlwaysVisibleControlExtender1.VerticalSide = VerticalSide.Bottom;
break ;
default :
AlwaysVisibleControlExtender1.VerticalSide = VerticalSide.Middle;
break ;
}
}
常用属性:
1、TargetControlID: 需要保持’悬浮’状态的控件ID.
2、HorizontalSide: 被控制控件的水平位置,可以为Left, Center,Right,默认值是Left.
3、HorizontalOffset: 结合上面的horizontalSide来使用,如果horizontalSide为Left,那么把HorizontalOffset设置为10px,表示距离浏览器左边10px。
4、VerticalSide: 被控制控件的垂直位置,可以为Top,Middle,Bottom。 默认值是Top.
5、VertivcalOffset: 和上面的VerticalSide结合控制控件距离VerticalSide多少像素。如果VerticalSide设置为Top, VerticalOffset设置为20px,那么表示控件距离Top的距离是20px.
6、ScrollEffectDuration: 滚动效果周期设置,我不大清楚有什么用处。
CS代码,引入命名空间 using AjaxControlToolkit;