在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
<script language="javascript" type="text/javascript">
> 2. AlwaysVisibleControl 观点: 这个控件比较简单,但是控制显示位置的代码还是很有用的 看看:
<asp:DropDownList ID="ddlPosition" runat="server"
AutoPostBack="true" OnSelectedIndexChanged="OnChange"> <asp:ListItem Text="Default" Selected="true" Value="None" /> <asp:ListItem Text="Top Left" Value="TL" /> <asp:ListItem Text="Top Center" Value="TC" /> <asp:ListItem Text="Top Right" Value="TR" /> <asp:ListItem Text="Middle Left" Value="ML" /> <asp:ListItem Text="Middle Center" Value="MC" /> <asp:ListItem Text="Middle Right" Value="MR" /> <asp:ListItem Text="Bottom Left" Value="BL" /> <asp:ListItem Text="Bottom Center" Value="BC" /> <asp:ListItem Text="Bottom Right" Value="BR" /> </asp:DropDownList> /// <summary> /// Update properties of the extender /// </summary> protected void OnChange(object sender, EventArgs e) { 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; } } 3.Animation
代码示意
<asp:Panel ID="Panel6" runat="server" Width="100%"> <asp:Panel BorderStyle="Solid" BorderWidth="2px" BorderColor="black" ID="Panel7" runat="server" Width="100%" Height="20px"> <div class="dragMe">Drag Me</div> </asp:Panel> <asp:Panel BorderStyle="Solid" BackColor="#0B3D73" ForeColor="whitesmoke" BorderWidth="2px" BorderColor="black" ID="Panel8" runat="server" Width="100%" Height="250px" Style="overflow: scroll;"> <div> <p>This panel will reset its position on a postback or page refresh.</p> <hr /> <p><%= GetContentFillerText()%></p> </div> </asp:Panel> </asp:Panel> <ajaxToolkit:DragPanelExtender ID="DragPanelExtender1" runat="server" TargetControlID="Panel6" DragHandleID="Panel7" > 8.DropDown
代码示意:
<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> > 9.DropShadow
代码示意:
<asp:Panel ID="Panel1" runat="server" CssClass="dynamicPopulate_Normal"> </asp:Panel> //要扩展的panel <ajaxToolkit:DynamicPopulateExtender ID="dp" BehaviorID="dp1" runat="server" ClearContentsDuringUpdate="true" PopulateTriggerControlID="Label1" TargetControlID="Panel1" ServiceMethod="GetHtml" UpdatingCssClass="dynamicPopulate_Updating"> </ajaxToolkit:DynamicPopulateExtender> 11.FilteredTextBox
特殊键排除代码:
< var scanCode; if (evt.rawEvent.keyIdentifier) { // Safari // Note (Garbin): used the underlying rawEvent insted of the DomEvent instance. if (evt.rawEvent.ctrlKey || evt.rawEvent.altKey || evt.rawEvent.metaKey) { return; } if (evt.rawEvent.keyIdentifier.substring(0,2) != "U+") { return; } scanCode = evt.rawEvent.charCode; if (scanCode == 63272 /* Delete */) { return; } } else { scanCode = evt.charCode; } if (scanCode && scanCode >= 0x20 /* space */) { var c = String.fromCharCode(scanCode); if(!this._processKey(c)) { evt.preventDefault(); } } } 12.HoverMenu 代码示意:
<input type="checkbox" name="checkA" onpropertychange="for(i=0;i<A.children.length;i++){A.children[i].checked=this.checked}">a
15.NoBot<br> <span id="A"> <input type="checkbox" name="A1"> <input type="checkbox" name="A2"> <input type="checkbox" name="A3"> </span> 观点: 简单解释什么意思,你点击一个按钮需要一秒钟的时间,而这一秒钟的时间你不可能再做其他的操作 比如再点一次;这样旧区分出了人和机器。避免机器人自动点击 注册 暴力破解之类的事情 16.NumericUpDown 观点:上下按钮是可以自定义美化的,不需要美化 TargetButtonDownID=" " TargetButtonUpID=" "
代码示意:
<asp:Image ID="img1" runat="server" ImageUrl="~/images/down.gif" AlternateText="Down" Width="20" Height="15"/> <asp:Image ID="img2" runat="server" ImageUrl="~/images/up.gif" AlternateText="Up" Width="20" Height="15"/> <ajaxToolkit:NumericUpDownExtender ID="NumericUpDownExtender4" runat="server" TargetControlID="TextBox4" Width="80" TargetButtonDownID="img1" TargetButtonUpID="img2" RefValues="" ServiceDownMethod="" ServiceUpMethod="" /> 17.PagingBulletedList 观点: 我用这个做了一个管理超链接的页面,效果不错
代码示意:
<ajaxToolkit:PagingBulletedListExtender ID="PagingBulletedListExtender1" BehaviorID="PagingBulletedListBehavior1" runat="server" TargetControlID="BulletedList1" ClientSort="true" IndexSize="1" Separator=" - " SelectIndexCssClass="selectIndex" UnselectIndexCssClass="unselectIndex" />
19.PopupControl 20.Rating
<ajaxToolkit:ReorderList ID="ReorderList1" PostBackOnReorder="false" runat="server" DataSourceID="ObjectDataSource1" CallbackCssStyle="callbackStyle"
DragHandleAlignment="Left" ItemInsertLocation="Beginning" DataKeyField="ItemID" SortOrderField="Priority"> <ItemTemplate></ItemTemplate> <EditItemTemplate></EditItemTemplate> <ReorderTemplate></ReorderTemplate> <DragHandleTemplate> </DragHandleTemplate> <InsertItemTemplate> </InsertItemTemplate> </ajaxToolkit:ReorderList>
23.RoundedCorners
27.ToggleButton 28.ValidatorCallout
代码示意:
<asp:RequiredFieldValidator runat="server" ID="PNReq" ControlToValidate="PhoneNumberTextBox" Display="None" ErrorMessage="<b> Required Field Missing</b><br />A phone number is required.<div style='margin-top:5px;padding:5px;border:1px solid #e9e9e9;background-color:white;'> <b>Other Options:</b><br /><a href='javascript:alert("No phone number available in profile.");'>Extract from Profile</a></div>" /> <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="PNReqE" TargetControlID="PNReq" HighlightCssClass="highlight" Width="350px" /> 全文完 |
请发表评论