细节决定成败,回头再说现在开始…………
1.Accordion
功能:实现了QQ、Msn好友分类的折叠效果,就像包含了多个CollapsiblePanels
细节: (1)不要把Accordion放在Table种同时又把 FadeTransitions 设置为True,这将引起布局混乱
(2)每一个 AccordionPane control 有一个Header 和Content的 template
(3)在Content中可以进行任意扩展,你什么都可以放上^_^
(4)有三种AutoSize modes :None(推荐) Limit Fill
(5)Accordion表现的更像是一个容器
代码示意:
<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="" onclick="return false;" class="accordionLink">1. Accordion</a></Header>
<Content>
</Content>
</ajaxToolkit:AccordionPane>
</Panes>
</ajaxToolkit:Accordion>
2. AlwaysVisibleControl
功能:最多的应用是在线小说的目录和不胜其烦的浮动小广告
细节: (1)避免控件闪烁,把这个控件要在目标位置时使用absolutely position
(2) HorizontalSide="Center" VerticalSide="Top" 使用这个方法控制浮动在什么位置
代码示意:
<cc1:AlwaysVisibleControlExtender ID="AlwaysVisibleControlExtender1" HorizontalSide="Center" VerticalSide="Top" TargetControlID="Panel1" runat="server">
3.Animation
功能:28个控件种效果最酷的!顾名思义实现动画效果
细节: (1)不只是控件:pluggable, extensible framework
(2)用在什么时候:OnLoad OnClick OnMouseOver OnMouseOut OnHoverOver OnHoverOut
(3)具体使用有很多可以谈的,有理由单独写一个Animation Xml 编程介绍
代码示意:
<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.CascadingDropDown
功能:DropDownList联动,调用Web Service
细节: (1)DropDownList行为扩展
(2)如果使用Web service 方法签名必须符合下面的形式:
[WebMethod]
public CascadingDropDownNameValue[] GetDropDownContents(
string knownCategoryValues, string category){...}
代码示意:
<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"/>
5.CollapsiblePanel
功能:Xp任务栏折叠效果
细节: (1)可以扩展任何一个 ASP.NET Panel control
(2) CollapsiblePanel 默认认为使用了 标准 CSS box model 早期的浏览器要!DOCTYPE 中设置页面为自适应方式提交数据rendered in IE's standards-compliant mode.
代码示意:
<ajaxToolkit:CollapsiblePanelExtender ID="cpe" runat="Server"
TargetControlID="Panel1"
CollapsedSize="0"
ExpandedSize="300"
Collapsed="True"
ExpandControlID="LinkButton1"
CollapseControlID="LinkButton1"
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"/>
6.ConfirmButton
功能:就是弹出来一个确定对话框
细节:本人认为不是最简单实现的方法,我的方法:
this.Button1.Attributes["onclick"]="javascript:return confirm('确定要停止下载么?');";
不知道是不是我没有发现这个控件的其它优势。
7.DragPanel
功能:页面拖动
细节: (1)TargetControlID 要拖动的控件
(2)DragHandleID 拖动的标题栏所在的ControlID
代码示意
<ajaxToolkit:DragPanelExtender ID="DPE1" runat="server"
TargetControlID="Panel3"
DragHandleID="Panel4" />
8.DropDown
功能:什么都可以以下拉菜单的形式弹出来
细节: (1)TargetControlID要在什么控件上实现扩展
(2)DropDownControlID弹出来什么
代码示意:
<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" />
9.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" />
10.DynamicPopulate
功能:能实用Web Service或页面方法来替换控件的内容
细节: (1)ClearContentsDuringUpdate 替换之前先清除以前的内容(默认True)
(2)PopulateTriggerControlID 触发器绑定的控件 单击时触发
(3)ContextKey传递给Web Service的随机字符串
(4) Web Service方法签名必须符合下面的形式:
[WebMethod]
string DynamicPopulateMethod(string contextKey)
{...}
Note you can replace "DynamicPopulateMethod" with a naming of your choice, but the return
type and parameter name and type must exactly match, including case.
代码示意:
<ajaxToolkit:DynamicPopulateExtender ID="dp" runat="server"
TargetControlID="Panel1"
ClearContentsDuringUpdate="true"
PopulateTriggerControlID="Label1"
ServiceMethod="GetHtml"
UpdatingCssClass="dynamicPopulate_Updating" />
11.FilteredTextBox
功能:文本框数据过滤
细节: (1)过滤条件Numbers LowercaseLetters UppercaseLetters Custom
(2)过滤条件也可以是Custom的组合 FilterType="Custom, Numbers"
(3)ValidChars="+-=/*()." Custom要定义这样的有效字符串
(4) 其实这是个鸡肋:你可以输入中文,聊胜于无,忍了
示意代码:
<ajaxToolkit:FilteredTextBoxExtender ID="ftbe" runat="server"
TargetControlID="TextBox3"
FilterType="Custom, Numbers"
ValidChars="+-=/*()." />
12.HoverMenu
功能:鼠标靠近时显示菜单,可以用在在线数据修改的表格上作为功能菜单
细节: (1)PopupControlID要弹出来什么
(2)PopupPostion 在哪里弹出来Left (Default), Right, Top, Bottom, Center.
(3)OffsetX/OffsetY 弹出项与源控件的距离
(4) PopDelay 弹出延时显示 单位milliseconds. Default is 100.
代码示意:
<ajaxToolkit:HoverMenuExtender ID="hme2" runat="Server"
TargetControlID="Panel9"
HoverCssClass="popupHover"
PopupControlID="PopupMenu"
PopupPosition="Left"
OffsetX="0"
OffsetY="0"
PopDelay="50" />
13.ModalPopup
功能:Xp的关机效果,后面全部灰掉,很多邮箱的删除对话框都着种效果
细节: (1)本质上讲这是一个对话框模版,比ConfirmButton有意义有更强的扩展性!
(2)从下面的代码中我们发现 点OK的时候可以调用后台方法
(3)同时可以执行一段脚本
代码示意:
<asp:Panel ID="Panel2" runat="server" CssClass="modalPopup" style="display:none">
<p>
<asp:Label ID="Label1" runat="server" BackColor="Blue" ForeColor="White" Style="position: relative"
Text="信息提示"></asp:Label> </p>
<p >确定要删除当前下载的任务么?</p>
<p style="text-align:center;">
<asp:Button ID="Button1" runat="server" Text="OK" ></asp:Button>
<asp:Button ID="Button2" runat="server" Text="Cancel"></asp:Button>
</p>
</asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="LinkButton1"
PopupControlID="Panel2" BackgroundCssClass="modalBackground" DropShadow="true"
OkControlID="Button1" OnOkScript="onOk()" CancelControlID="CancelButton" />
14.MutuallyExlcusiveCheckBox
功能:互斥复选框就像Radio一样
细节: (1)Key属性用来分组就像RdiolistGroup一样
(2)argetControlID用来绑定已有的CheckBox
代码示意:
<ajaxToolkit:MutuallyExclusiveCheckboxExtender runat="server"
ID="MustHaveGuestBedroomCheckBoxEx"
TargetControlID="MustHaveGuestBedroomCheckBox"
Key="GuestBedroomCheckBoxes" />
15.NoBot
功能:Captcha 图灵测试反垃圾信息控件
细节: (1)OnGenerateChallengeAndResponse 这个属性是EventHandler<NoBotEventArgs> 调用服务器端的方法,注意方法签名
例如: protected void CustomChallengeResponse(object sender, NoBotEventArgs e) {……}
代码示意:
<ajaxToolkit:NoBot
ID="NoBot2"
runat="server"
OnGenerateChallengeAndResponse="CustomChallengeResponse"
ResponseMinimumDelaySeconds="2"
CutoffWindowSeconds="60"
CutoffMaximumInstances="5" />