<%...@RegisterAssembly="System.Web.Extensio" />

ajax扩展控件(2)

系统 1661 0
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"
>

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

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

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



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

using AjaxControlToolkit;

public partial class AlwaysVisibleControlDemo:System.Web.UI.Page
... {
protected void Page_Load( object sender,EventArgse)
... {
if ( ! IsPostBack)
avce.Enabled
= false ;
}

protected void OnChange( object sender,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 ;
}

}

}


ajax扩展控件(2)


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论