1. Accordion【功能概述】
Accordion可以让你设计多个panel 并且一次只显示一个Panel .在页面上的显示效果就像是使用了多个CollapsiblePanels只不过每一次只展开其中一个CollapsiblePanel.Accordion控件内部包含了若干个AccordionPane,每一个AccordionPane的template里包括了对其Header和Content的定义。我们可以在后台代码中通过SelectedIndex属性取得当前展开的哪一个Panel,还可以控制哪一个Panel展开。
经常可以见到类似的效果,比如QQ、Msn好友分类的折叠效果。
【细节】
(1)不要把Accordion放在Table中而又把 FadeTransitions 设置为True,这将引起布局混乱
(2) 在AccordionPane模板中的Content中可以定义任何Web元素,表现的就像一个容器
(3) AccordionPane内容模板自动改变大小有三种AutoSize modes :None(推荐) Limit Fill
(4) $find('ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender')这里找到的是Behavior.什么是Behavior呢?在Asp.net Ajax框架中包含一组动作并完成一个功能. Accordion的一个Behavior就是淡入淡出.
找到Behavior的引用,behavior.set_FadeTransitions() behavior.get_FadeTransitions()的方式来实现具体某一个Behavior的访问和修改.
var behavior = $find('ctl00_SampleContent_MyAccordion_AccordionExtender');这种写法是不好的,我们在自动测试的页面中发现了更好的写法: var behavior=$find("<%= MyAccordion.ClientID %>_AccordionExtender");

【代码示意】
      <script language="javascript" type="text/javascript">
             function toggleFade() {
                 var behavior = $find('ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender');
                 if (behavior) {        
                     behavior.set_FadeTransitions(!behavior.get_FadeTransitions());
                 }
             }
             function changeAutoSize() {
                 var behavior = $find('ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender');
                 var ctrl = $get('autosize');     //这里找的是下拉列表控件,不是Behavior
                 if (behavior) {
                     var size = 'None';    // 这里顺便看看怎么使用Select
                     switch (ctrl.selectedIndex) {
                         case 0 :
                             behavior.get_element().style.height = 'auto';
                             size = AjaxControlToolkit.AutoSize.None;
                             break;
                         case 1 :
                             behavior.get_element().style.height = '400px';
                             size = AjaxControlToolkit.AutoSize.Fill;
                             break;
                         case 2 :
                             behavior.get_element().style.height = '400px';
                             size = AjaxControlToolkit.AutoSize.Limit;
                             break;
                     }
                     behavior.set_AutoSize(size);
                 }
                 if (document.focus) {
                     document.focus();
                 }
             }
         </script>

<ajaxToolkit:Accordion ID="MyAccordion" runat="server" SelectedIndex="0" HeaderCssClass="accordionHeader"
             ContentCssClass="accordionContent" FadeTransitions="false" FramesPerSecond="40"
             TransitionDuration="250" AutoSize="None">
             <Panes>
                 <ajaxToolkit:AccordionPane ID="AccordionPane1" runat="server">
                     <Header>
                         <a href="" οnclick="return false;" class="accordionLink">1. Accordion</a></Header>
                     <Content>
                     </Content>
                 </ajaxToolkit:AccordionPane>
             </Panes>
         </ajaxToolkit:Accordion>

2. AlwaysVisibleControl【功能概述】
AlwaysVisibleControl 是一个简单的扩展控件可以让一部分内容浮动在页面上,当滚动页面或者改变浏览器大小时总是可见的。它可以扩展任意一个Asp.net 控件,并可按照要求设置水平 竖直方向上的相对距离.
最多的应用是在线阅读的目录和不胜其烦的浮动小广告。

【细节】
(1)   避免控件闪烁,要扩展的控件要使用absolutely position
(2)   HorizontalSide="Center" VerticalSide="Top" 使用这个方式控制浮动的位置
(3)   Var label = ocument.getElementById('ctl00_SampleContent_currentTime');这行代码我们可以使用更简单的方法:
      var label = $get('ctl00_SampleContent_currentTime');
【代码示意】
代码示意:
     <cc1:AlwaysVisibleControlExtender ID="AlwaysVisibleControlExtender1" HorizontalSide="Center" VerticalSide="Top"   TargetControlID="Panel1" runat="server">

3. Animation【功能概述】
28个控件种效果最酷的!顾名思义实现动画效果。它是一个插入式,可扩展的框架可以方便的为你的页面添加动画效果。
【细节】
请参考页面代码阅读下面的细节内容:
(1)Sys.UI.DomElement.getLocation(b) 取得控件位置的函数,常用!!!
     (2)动画分为两种:Animation Action 后者的强大让我很兴奋
     (3)<Sequence> </Sequence> 顺序执行的动画脚本
     (4)<Parallel> <Parallel > 并发执行的动画脚本
     (5)【Action】 <StyleAction AnimationTarget="btnCloseParent" Attribute="opacity" value="0" /> 控制目标元素外观样式,属性--值的格式修改,一个元素可以应用多个StyleAction
      (6)【Action】<EnableAction AnimationTarget="ctl00_ContentPlaceHolder1_btnInfo" Enabled="true" /> 控件是否可用使用的方式跟上面是一样的,当前控件可省略AnimationTarget
(7)【Action】 <ScriptAction Script="Cover($get('ctl00_ContentPlaceHolder1_btnInfo'), $get('flyout'));" />执行一段脚本的Action          
    (8) 【Action】 <HideAction />隐藏目标的控件
    (9) 【Action】<OpacityAction AnimationTarget="info" Opacity="0" /> 设置透明度的Action
   (10)【Animation】 <FadeIn AnimationTarget="info" Duration=".2"/>       <FadeOut /> 淡入淡出    
(11)【Animation】<Scale ScaleFactor="0.05" Center="true" ScaleFont="true" FontUnit="px" />    控制目标元素的大小但是注意:If scaleFont is true, the size of the font will also scale with the element. If center is true, then the element's center will not move as it is scaled. It is important to note that the target must be positioned (i.e. absolutely) so that settings its top/left properties will change its location in order for center to have an effect.
      (12) 【Animation】    <Pulse Duration=".1" /> 脉搏跳动效果          
      (13)【Animation】 <Color Duration=".2" StartValue="#FFFFFF" EndValue="#FF0000" Property="style" PropertyKey="color" /> 颜色渐变效果,设置起始结束颜色就可以
     (14) 【Animation】 <Resize Width="260" Height="280" />改变元素的大小Action
(15)动画效果是在用户某一个动作发生的时候触发,触发的时机包括:OnLoad OnClick OnMouseOver OnMouseOut OnHoverOver OnHoverOut
正式版的页面文件为动画脚本添加了注释更加清晰易懂.上面列出的是常用的一些动画效果,全部资料参见Anmation Reference。
仔细阅读Animation的页面代码,其实我们已经提前触摸到了Xaml的编程风格。Asp.net Ajax之后的下一代WEB界面是WPF/E,WPF/E现在支持的是”javascript+Xaml” 还不支持”C# + Xaml”。
下一代的WEB UI会是怎样的?下一个版本的Asp.net 会怎样安排Ajax的位置?WPF/E会不会被整合在新版本的Asp.net中呢?期待中……

【示意代码】
代码示意:
    <ajaxToolkit:AnimationExtender ID="ae"
   runat="server" TargetControlID="ctrl">
     <Animations>
         <OnLoad> </OnLoad>
         <OnClick> </OnClick>
         <OnMouseOver> </OnMouseOver>
         <OnMouseOut> </OnMouseOut>
         <OnHoverOver> </OnHoverOver>
         <OnHoverOut> </OnHoverOut>
     </Animations>
</ajaxToolkit:AnimationExtender>

4. AutoComplete NEW!!!【功能概述】
AutoComplete控件是对Asp.net文本框控件的扩展,当用户词汇前面的字母时以弹出区域的形式给出备选词。这个功能的完成依赖于特定的Web Service。
在正式版的Ajax Control Toolkit中看到自动完成扩展控件有一种感觉:它终于出现在了它应该出现的地方。之前AutoComplete控件是在CTP版本中以核心组件的形式出现的,这个功能极为明确的控件被归类到核心组件,我还是比较迷惑。正式版中它终于成为了一个扩展控件。
Google的自动完成功能,新浪 网易等信箱的收件人自动完成功能是这个功能的成功应用。
【细节】
从Atlas的版本开始,AutoComplete的使用方法就没有太大的改变,只要注意:
(1)调用的Web Service方法签名有要求:
           [WebMethod]
           public string[] GetCompletionList(string prefixText, int count) { ... }
      (2)MinimumPrefixLength最短前缀字符数,就是说你至少要键入几个字符才会出现提示

5. Calendar NEW!!!【功能概述】
Calendar同样是对文本框的扩展,当点击文本框的时候弹出日期选择选项。现在的版本提供的功能已经和WinForm中的日期控件一样,可以通过点击日期选择,点击箭头在年月之间切换。
【细节】
          (1)同样是对文本框的扩展,文本框获得焦点就会出现日期选择,样式是可以自定义的
          (2)虽然一定是对文本框的扩展但是我们还是可以指定弹出按钮PopupButtonID,一旦这个值设定了,文本框获得焦点也不会弹出日期选择
          (3)不需要把它放在UpdatePanel中

6. CascadingDropDown【功能概述】
CascadingDropDown 控件是对ASP.NET DropDownList control的扩展,实现对一个DropDownList操作时其它DropDownList发生相应的变化。这个功能的实现依赖于Web Service。
【细节】
(1)如果使用Web service 方法签名必须符合下面的形式:
                [WebMethod]
                public CascadingDropDownNameValue[] GetDropDownContents(
                string knownCategoryValues, string category){...}
(2)在阅读代码的时候请关注:Category属性。官方说法The name of the category this DropDownList represents 实打开~/App_Data/CarsService.xml你就发现这是Xml的元素标签。从这个角度我们就解决了为什么联动,即联动的本质;同时也明白了调用Service的参数约定。
【示意代码】
       <ajaxToolkit:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="DropDownList1" Category="Make"   PromptText="Please select a make"   LoadingText="[Loading makes ]"   ServicePath="CarsService.asmx" ServiceMethod="GetDropDownContents"/>
                 <ajaxToolkit:CascadingDropDown ID="CascadingDropDown2" runat="server" TargetControlID="DropDownList2" Category="Model" PromptText="Please select a model" LoadingText="[Loading models ]" ServiceMethod="GetDropDownContentsPageMethod" ParentControlID="DropDownList1"/>
                 <ajaxToolkit:CascadingDropDown ID="CascadingDropDown3" runat="server" TargetControlID="DropDownList3" Category="Color" PromptText="Please select a color" LoadingText="[Loading colors ]" ServicePath="~/CascadingDropDown/CarsService.asmx" ServiceMethod="GetDropDownContents" ParentControlID="DropDownList2"/>

另外页面上还有一段定义UpdatePanel的代码很典型,可以作为参考:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" RenderMode="inline">
            <ContentTemplate>
                <asp:Label ID="Label1" runat="server" Text="[No response provided yet]" />
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="DropDownList3" EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>
7. CollapsiblePanel【功能概述】
这个控件几乎在每一个页面上都出现了。它是非常灵活的一个控件,可以扩展任何ASP.NET Panel control。在页面上轻松实现展开收缩效果。这种效果我们最熟悉的恐怕就是XP的文件任务栏了。
【细节】
(1)    CollapsiblePanel 默认认为使用了 标准 CSS box model 早期的浏览器要!DOCTYPE 中设置页面为自适应方式提交数据rendered in IE's standards-compliant mode.
(2)    可以自动展开 自动收缩Autoexpand="true" AutoCollapse="true"但是这两个本身是互斥的不能同时为True;如果设置了这两个属性其中一个为True就不要在设置 Collapsed="True",这样就没有意义了。
(3)    TextLabelID="Label1"这个属性有什么深意\高级的操作么?我还在研究。。。
代码示意:
    <ajaxToolkit:CollapsiblePanelExtender ID="cpe" runat="Server"
     TargetControlID="Panel1"
     CollapsedSize="0"
     ExpandedSize="300"
     Collapsed="True"
     ExpandControlID="Image1"
     CollapseControlID="Image1"
     AutoCollapse="False"
     AutoExpand="False"
     ScrollContents="True"
     TextLabelID="Label1"
     CollapsedText="Show Details "
     OpenedText="Hide Details"
     ImageControlID="Image1"
     ExpandedImage="~/images/collapse.jpg"
     CollapsedImage="~/images/expand.jpg"
     ExpandDirection="Height"
    SuppressPostBack ="true"/>

8. ConfirmButton

【功能概述】
这个控件是对Button和继承了Button的控件的扩展,它可以捕捉到用户点击了对话框中的“是”“否”;如果是“是”就继续执行后面的代码,反之就停止执行它默认的提交行为。
【细节】
(1) 要扩展的LinkButton Button 以及ConfirmButtonExtender都要放在updatepanel里面
       如果是放在外面,点击“确定”或者“取消”之后还是会导致页面刷新!
(2)更简单的方法:
this.Button1.Attributes["onclick"]="javascript:return confirm('确定要停止下载么?');";
(3) 如果是需要服务器端获取用户选择,还是使用模式弹出吧
9.DragPanel【功能概述】
DragPanel extender可以轻松的让控件 "draggability".DragPanel 扩展的目标是任意 ASP.NET Panel .你可以设置拖动行为的细节,比如哪里是类似于标题栏一样的区域。
【细节】
(1)   TargetControlID 要拖动的控件
(2)   DragHandleID   拖动的标题栏所在的ControlID 示例代码中: panel6包含panel7(标题) panel8(内容)扩展的对象是panel6
(3)   是不是发现这段JS代码了呢?如果去掉这段代码,图到页面边缘的时候是不正常的,它自己跑回原来位置了 :)
        <script type="text/javascript">
        // The following snippet works around a problem where FloatingBehavior
        // doesn't allow drops outside the "content area" of the page - where "content
        // area" is a little unusual for our sample web pages due to their use of CSS
        // for layout.
        function setBodyHeightToContentHeight() {
            document.body.style.height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight)+"px";
        }
        setBodyHeightToContentHeight();
        $addHandler(window, "resize", setBodyHeightToContentHeight);    
    </script>

【示意代码】
代码示意
<ajaxToolkit:DragPanelExtender ID="DPE1" runat="server"
     TargetControlID="Panel3"
     DragHandleID="Panel4" />

10. DropDown【功能概述】
DropDown 同样是一个 ASP.NET AJAX extender 可以对任何 ASP.NET control 进行扩展实现 SharePoint-style drop-down menu效果。弹出的只不过是其它的panel或者控件而已。   在IE浏览器中下拉列表总是在最前面的,的确是影响页面效果,这个控件的出现可以解决这一问题.这随时随地的弹出窗口成为WEB 2.0网站的标志性建筑,弹出的东西也越来越丰富。
【细节】
(1)TargetControlID要在什么控件上实现扩展
     (2)DropDownControlID弹出来什么
(3) 示例中是对一个Label进行的扩展,我试着扩展TextBox效果更好!
【示意代码】
代码示意:
   <asp:Panel ID="DropPanel" runat="server" CssClass="ContextMenuPanel" Style="display: none;
             visibility: hidden;">
              <asp:LinkButton runat="server" ID="Option1" Text="Option 1" CssClass="ContextMenuItem"
                 OnClick="OnSelect" />
             <asp:LinkButton runat="server" ID="Option2" Text="Option 2" CssClass="ContextMenuItem"
                 OnClick="OnSelect" />
             <asp:LinkButton runat="server" ID="Option3" Text="Option 3 (Click Me!)" CssClass="ContextMenuItem"
                 OnClick="OnSelect" />
         </asp:Panel>
         <cc1:DropDownExtender runat="server" ID="DDE" TargetControlID="TextLabel"
             DropDownControlID="DropPanel" />
还有一段代码有很多可以学习的地方:
代码示意:
   <asp:UpdatePanel id="Update" runat="server">
             <ContentTemplate>
                 <asp:Label id="lblSelection" runat="server" Style="padding: 5px;" />
             </ContentTemplate>
             <Triggers>
                 <asp:AsyncPostBackTrigger ControlID="Option1" EventName="Click" />
                 <asp:AsyncPostBackTrigger ControlID="Option2" EventName="Click" />
                 <asp:AsyncPostBackTrigger ControlID="Option3" EventName="Click" />
             </Triggers>
         </asp:UpdatePanel>
         <ajaxToolkit:UpdatePanelAnimationExtender ID="UpdateAnimation" runat="server" TargetControlID="Update" BehaviorID="Highlight">
             <Animations>
                 <OnUpdated>
                     <Sequence>
                         <ScriptAction Script="$find('Highlight')._onUpdated._animation._animations[1].set_target($get('ctl00_ContentPlaceHolder1_lblSelection'));" />
                         <Color Duration=".5" StartValue="#FFFF90" EndValue="#FFFFFF" Property="style" PropertyKey="backgroundColor" />
                     </Sequence>
                 </OnUpdated>
             </Animations>
         </ajaxToolkit:UpdatePanelAnimationExtender>

11. DropShadow【功能概述】
阴影效果
【细节】
(1)   Width 单位:px 默认5px
(2)   Opacity 不透明度0-1.0 默认.5
【示意代码】
  代码示意:
     <ajaxToolkit:DropShadowExtender ID="dse" runat="server"
         TargetControlID="Panel1"
         Opacity=".8"
         Rounded="true"
         TrackPosition="true" />

转载于:https://www.cnblogs.com/freedom831215/archive/2009/10/03/1577506.html

Ajax Control Toolkit 控件介绍相关推荐

  1. 第十一篇: Ajax Control Toolkit 控件包--下载与安装

    Ajax Control Toolkit 控件包 可以是说 == 超炫动态效果 !! 1.下载: 下载地址:http://www.codeplex.com/AtlasControlToolkit/Re ...

  2. AJAX Control Toolkit 控件学习(转自csdn山巅)

    AJAX Control Toolkit 控件学习 2006-1-16 ToggleButton 关联ASP.NET CheckBox控件 RoundedCorder 造就圆角框 PasswordSt ...

  3. ajax control toolkit vs2013,如何将Ajax Control Toolkit控件安装到Visual Studio 2005工具箱

    摘要:如何将 Ajax Control Toolkit 控件安装到 Visual Studio 2005 工具箱 How to Install Ajax Control Toolkit for Vis ...

  4. Ajax Extensions核心控件介绍

    摘自:http://www.cnblogs.com/remember515/archive/2007/06/28/799030.html Ajax的核心组件包括ScriptManager.Script ...

  5. 细数Ajax Control Toolkit 34个服务器端控件

    1. Accordion [功能概述] Accordion可以让你设计多个panel 并且一次只显示一个Panel .在页面上的显示效果就像是使用了多个CollapsiblePanels只不过每一次只 ...

  6. 开始使用asp.net ajax的控件工具包AJAX Control Toolkit

    我们来为我们的 toolbox 添加一些资源 , 这个要通过下载安装 asp.net ajax 工具包完成.登录 www.asp.net 点击 AJAX 按钮,然后找到 ASP.NET AJAX Co ...

  7. Ajax Control Toolkit 32个服务器端控件

    1. Accordion [功能概述]Accordion可以让你设计多个panel 并且一次只显示一个Panel .在页面上的显示效果就像是使用了多个CollapsiblePanels只不过每一次只展 ...

  8. Ajax Control Toolkit 34个服务器端控件 详解

    1. Accordion [功能概述] Accordion可以让你设计多个panel 并且一次只显示一个Panel .在页面上的显示效果就像是使用了多个CollapsiblePanels只不过每一次只 ...

  9. Ajax Control Toolkit 34个服务器端控件

    1. Accordion [功能概述] Accordion可以让你设计多个panel 并且一次只显示一个Panel .在页面上的显示效果就像是使用了多个CollapsiblePanels只不过每一次只 ...

  10. Asp.Net Ajax Control Toolkit 服务器端控件

    1. Accordion [功能概述] Accordion可以让你设计多个panel 并且一次只显示一个Panel .在页面上的显示效果就像是使用了多个CollapsiblePanels只不过每一次只 ...

最新文章

  1. linux 常用的系统信息查看命令
  2. Android性能优化之启动优化实战篇,积累总结
  3. 如何查看无线网卡型号_如何检查笔记本电脑是否具有内置无线网卡?
  4. 【字符串反转总结】Java中七种方法实现
  5. 模板:二叉搜索树平衡树
  6. 万字详解|手撕 9大排序算法!
  7. python类中变量作用域_python进阶14变量作用域LEGB
  8. Chrome浏览器快速获取静态控件的XPATH
  9. JSK-118 输出格式练习【入门】
  10. Object.defineProperty 接口浏览器实现的bug.和疑惑
  11. Servlet(2) 三个域对象
  12. StretchDIBits函数
  13. 用JavaScript写一个鼠标悬停变色事件
  14. 真的会有大牛市吗老大?前提条件是破2万美刀,差一刀都不行!
  15. SpringSecurity自定义多Provider时提示No AuthenticationProvider found for问题的解决方案与原理(一)
  16. 外网打点(信息收集)
  17. mysql pdo 端口_链接Mysql的api mysqli和pdo
  18. 【android studio】安卓实现mysql数据库登录、注册、重置密码。
  19. java unix 时间戳_「unix时间戳」Unix时间戳和Java中的时间戳的区别 - seo实验室
  20. Linux(ECS云服务器)

热门文章

  1. IDEA操作 名字快速驼峰等操作
  2. 小D课堂 - 零基础入门SpringBoot2.X到实战_第三节SpringBoot热部署devtool和配置文件自动注入实战_15、SpringBoot2.x配置文件讲解...
  3. Git 问题:SSL certificate problem: self signed certificate
  4. 制作jquery插件1-基础
  5. 在GRIDVIEW中合并单元格
  6. jdk8,lambda表达(简化代码)
  7. MySQL面试题中:主从同步部署介绍
  8. 微信小程序------开发测试
  9. stl中auto_ptr,unique_ptr,shared_ptr,weak_ptr四种智能指针使用总结
  10. 17.3.13--pycharm2和3的常识问题