AlwaysVisibleControl

AlwaysVisibleControl控件用来在页面上显示一个浮动的窗口,通常用它来显示菜单,消息和广告等。

属性列表:
TargetControlID : 控件的ID
HorizontalOffset : 控件距离浏览器的水平边距. 默认是0px。
HorizontalSide : 水平停靠方向。可选择(Left, Center, or Right)。默认是Left
VerticalOffset :控件距离浏览器的垂直边距. 默认是0px。
VerticalSide :垂直停靠方向。可选择(Top, Middle, or Bottom)。默认是Top。
ScrollEffectDuration : 控件复位时间,默认时间是0.1,单位是秒。
ProfileBindings:要绑定个性化配置中的属性。
常见问题以及使用技巧:
在页面刚刚完成加载时,悬浮在页面中的控件位置不正确,在接下来的一次面面闪烁之后,该控件才被固定到期望的正确位置上。
解决方案是把加载位置和特效位置设置相同;把实例中的Panel中的样式引用为此样式并做相应的修改。
    <style type="text/css">
        .login
        {
            background-color: #fff;
            border: 2px solid #000;
            position: absolute;
            left: 10px;
            top: 50px;
        }
    </style>

实例解析一、始终显示的消息窗口

1.UI界面
<form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>   
    </div>
        <asp:Panel ID="Panel1" runat="server" Height="25px" Width="292px">
            你有短消息!
        <asp:Panel ID="Panel2" runat="server" Height="192px" Width="290px">
            <strong><a href="#">查看</a></strong></asp:Panel>
        </asp:Panel>
        <cc1:alwaysvisiblecontrolextender id="AlwaysVisibleControlExtender1" runat="server"
            horizontaloffset="8" horizontalside="Right" targetcontrolid="Panel1" verticaloffset="8"
            verticalside="Middle"></cc1:alwaysvisiblecontrolextender><br/><br/>a<br/><br/>b<br/><br/>
            <br/><br/><br/>c<br/><br/><br/>d<br/><br/>br/><br/><br/><br/><br/><br/>f<br/>e<br/>
             <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>f<br/>e<br/>
    </form>

实例二、简单实现功能
<head runat="server">
    <title>AlwaysVisibleControl Demo</title>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .login
        {
            background-color: #fff;
            border: 2px solid #000;
            position: absolute;
            left: 10px;
            top: 50px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="sm" runat="server" />
        <asp:Login ID="myLogin" CssClass="login" runat="server">
        </asp:Login>
        <ajaxToolkit:AlwaysVisibleControlExtender ID="avce" TargetControlID="myLogin" HorizontalSide="Right"
            HorizontalOffset="10" VerticalSide="Top" VerticalOffset="50" runat="server" />
        <div>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
            <p>
                AlwaysVisibleControl Demo. AlwaysVisibleControl Demo. AlwaysVisibleControl Demo.
            </p>
        </div>
    </form>
</body>

 

posted @   Astar  阅读(731)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
点击右上角即可分享
微信分享提示