1、提交后的回发时能自动进入上次的当前位置

例如,如果数据项导致大型页回发,则最终用户需要将页滚动到此前正在编辑它们的位置,才能继续。页开发人员通过以下方法可以简单地标记窗体,以维持滚动位置:在 @Page 指令中将 MaintainScrollPositionOnPostBack 属性设置为 true,或在 Web.config 中进行此设置,以应用于应用程序中的所有页。

2、Button 控件的 OnClientClick 属性允许您在此按钮被单击时以编程方式运行客户端脚本。该按钮呈现客户端 onclick 属性以及按钮自身的 Javascript。

3、用于控件的一个令人惊喜的新功能是“客户端回调”,该功能允许控件向服务器执行带外请求以获取附加数据,而不发送整页。此功能依赖于用于回调处理(通常通过 XMLHTTP)的浏览器支持,该支持由 SupportsClientCallbacks 在浏览器功能中指定。

其实一般的无刷新页面就可以使用客户端回调来实现,只有复杂的才需要使用AJAX等

页面开发技巧<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeFile="CallBackEventHandler_cs.aspx.cs" Inherits="CallBackEventHandler_cs" %>
页面开发技巧
页面开发技巧
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
页面开发技巧
页面开发技巧
<html xmlns="http://www.w3.org/1999/xhtml" >
页面开发技巧
<head runat="server">
页面开发技巧   
<title>Client CallBack</title>
页面开发技巧
</head>
页面开发技巧
<body>
页面开发技巧
<form id="Form1" runat="server">
页面开发技巧
页面开发技巧   
<h3>Cascading DropDownLists Using ICallBackEventHandler</h3>
页面开发技巧   
<asp:DropDownList ID="ParentDropDown"
页面开发技巧    onchange
="GetChildren(this.options[this.selectedIndex].value, 'ddl');"   
页面开发技巧    Runat
="server">
页面开发技巧     
<asp:ListItem Text="Item 1" />
页面开发技巧     
<asp:ListItem Text="Item 2" />
页面开发技巧     
<asp:ListItem Text="Item 3" />
页面开发技巧   
</asp:DropDownList>
页面开发技巧   
<asp:DropDownList ID="ChildDropDown" AutoPostBack="true" style="visibility:hidden" Runat="Server">
页面开发技巧    
<asp:ListItem Text="Child Item" />
页面开发技巧   
</asp:DropDownList>
页面开发技巧   
<br /><br />
页面开发技巧   
<asp:Label ID="Label1" runat="server"/>
页面开发技巧
页面开发技巧   
<script type="text/javascript">
页面开发技巧

页面开发技巧//-----------------------------------------------------------------------
页面开发技巧
//  This file is part of the Microsoft .NET SDK Code Samples.
页面开发技巧
// 
页面开发技巧
//  Copyright (C) Microsoft Corporation.  All rights reserved.
页面开发技巧
// 
页面开发技巧
//This source code is intended only as a supplement to Microsoft
页面开发技巧
//Development Tools and/or on-line documentation.  See these other
页面开发技巧
//materials for detailed information regarding Microsoft code samples.
页面开发技巧
// 
页面开发技巧
//THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
页面开发技巧
//KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
页面开发技巧
//IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
页面开发技巧
//PARTICULAR PURPOSE.
页面开发技巧
//-----------------------------------------------------------------------
页面开发技巧

页面开发技巧
using System;
页面开发技巧
using System.Web.UI;
页面开发技巧
页面开发技巧
public partial class CallBackEventHandler_cs : System.Web.UI.Page, ICallbackEventHandler

相关文章: