ajax扩展控件(2)

AlwaysVisibleControl控件,控件用于 将有该控件指定的面板或者空间,在页面指定的方式显示出来。

页面代码如下:

<%...@PageLanguage="C#"AutoEventWireup="true"CodeFile="AlwaysVisibleControlDemo.aspx.cs"
Inherits
="AlwaysVisibleControlDemo"
%>

<%...@RegisterAssembly="System.Web.Extensions,Version=1.0.61025.0,Culture=neutral,
PublicKeyToken=31bf3856ad364e35
"
Namespace
="System.Web.UI"TagPrefix="asp"
%>

<%...@RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1"%>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>

<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>无标题页</title>
</head>
<body>
<formid="form1"runat="server">
<div>
&nbsp;<asp:ScriptManagerID="ScriptManager1"runat="server">
</asp:ScriptManager>
<asp:UpdatePanelID="update"runat="server">
<ContentTemplate>
<divstyle="width:230px;height:100px">
<asp:PanelID="displayPanel"runat="server"
Width
="220px"BackColor="White"ForeColor="DarkBlue"
BorderWidth
="2"BorderStyle="solid"BorderColor="DarkBlue"style="z-index:1;">
<divstyle="width:100%;height:100%;vertical-align:middle;text-align:center;"><p>可移动Panel:</p></div>
</asp:Panel>
<cc1:AlwaysVisibleControlExtenderID="avce"runat="server"
TargetControlID
="displayPanel"
VerticalSide
="Top"VerticalOffset="10"
HorizontalSide
="Right"HorizontalOffset="10"
ScrollEffectDuration
=".1"/>
</div>
<p>
选择需要移动到的Panel位置.
</p>
<p>

Position:
<asp:DropDownListID="ddlPosition"runat="server"
AutoPostBack
="true"OnSelectedIndexChanged="OnChange">
<asp:ListItemText="默认"Selected="true"Value="None"/>
<asp:ListItemText="左上"Value="TL"/>
<asp:ListItemText="上中"Value="TC"/>
<asp:ListItemText="右上"Value="TR"/>
<asp:ListItemText="左中"Value="ML"/>
<asp:ListItemText="中中"Value="MC"/>
<asp:ListItemText="右中"Value="MR"/>
<asp:ListItemText="左下"Value="BL"/>
<asp:ListItemText="中下"Value="BC"/>
<asp:ListItemText="右下"Value="BR"/>
</asp:DropDownList>
</p>

</ContentTemplate>
</asp:UpdatePanel>
&nbsp;
</div>
</form>
</body>
</html>



程序代码如下:
usingSystem;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Collections;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;

usingAjaxControlToolkit;

publicpartialclassAlwaysVisibleControlDemo:System.Web.UI.Page
...{
protectedvoidPage_Load(objectsender,EventArgse)
...{
if(!IsPostBack)
avce.Enabled
=false;
}

protectedvoidOnChange(objectsender,EventArgse)
...{
if(string.IsNullOrEmpty(ddlPosition.SelectedValue)||ddlPosition.SelectedValue.Length!=2)
...{
avce.Enabled
=false;
return;
}


avce.Enabled
=true;
switch(ddlPosition.SelectedValue[0])
...{
case'T':
avce.VerticalSide
=VerticalSide.Top;
break;
case'M':
avce.VerticalSide
=VerticalSide.Middle;
break;
case'B':
avce.VerticalSide
=VerticalSide.Bottom;
break;
default:
avce.Enabled
=false;
return;
}


switch(ddlPosition.SelectedValue[1])
...{
case'L':
avce.HorizontalSide
=HorizontalSide.Left;
break;
case'C':
avce.HorizontalSide
=HorizontalSide.Center;
break;
case'R':
avce.HorizontalSide
=HorizontalSide.Right;
break;
default:
avce.Enabled
=false;
return;
}

}

}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值