1Atlas 第一篇[ScriptManager]上个星期我们讨论了微软以Atlas形式来应对AJAX的潮流。Atlas基本上就是一个用来创建跨浏览器、跨平台的AJAX应用程序的ASP.NET 2.0框架。
  2Atlas 第一篇[ScriptManager]
  3Atlas 第一篇[ScriptManager]微软最近发布了四月社区技术预览(April Community Technology Preview)并声明认为已经准备好发布live许可证了。了解到这之后,我们将讨论Atlas的核心:ScriptManager类。
  4Atlas 第一篇[ScriptManager]
  5Atlas 第一篇[ScriptManager]关注的焦点
  6Atlas 第一篇[ScriptManager]
  7Atlas 第一篇[ScriptManager]ScriptManager类管理着Web页面上的所有Atlas组件。此外,它还会处理部分页面的更新并生成客户脚本,让你可以通过使用代理对象访问来自JavaScript的Web服务方法。
  8Atlas 第一篇[ScriptManager]
  9Atlas 第一篇[ScriptManager]每个使用Atlas组件的页面都只能带有一个ScriptManager控件,它在Web页面的开始部分公开。它会注册Atlas脚本,把它们放在页面上供使用。如果你正在使用ASP.NET 2.0,那么你可以在主页面上放一个ScriptManager控件,这样它就可以被使用主页面的所有页面用到了。ScriptManager控件的句法见列表A:
 10Atlas 第一篇[ScriptManager]
 11Atlas 第一篇[ScriptManager]<atlas:ScriptManager
 12Atlas 第一篇[ScriptManager]EnablePartialRendering="true|false"
 13Atlas 第一篇[ScriptManager]EnableScriptComponents="true|false"
 14Atlas 第一篇[ScriptManager]ID="string"
 15Atlas 第一篇[ScriptManager]runat="server" >
 16Atlas 第一篇[ScriptManager]<Scripts>
 17Atlas 第一篇[ScriptManager]<atlas:ScriptReference
 18Atlas 第一篇[ScriptManager]Browser="browser reference"
 19Atlas 第一篇[ScriptManager]Path="script file path"
 20Atlas 第一篇[ScriptManager]ScriptName="script file name" />
 21Atlas 第一篇[ScriptManager]</Scripts>
 22Atlas 第一篇[ScriptManager]<Services>
 23Atlas 第一篇[ScriptManager]<atlas:ServiceReference
 24Atlas 第一篇[ScriptManager]GenerateProxy="true|false"
 25Atlas 第一篇[ScriptManager]Path="server path name"
 26Atlas 第一篇[ScriptManager]Type="type name" />
 27Atlas 第一篇[ScriptManager]</Services>
 28Atlas 第一篇[ScriptManager]</atlas:ScriptManager> 
 29Atlas 第一篇[ScriptManager]现在让我们更加仔细地看看ScriptManager控件声明的各个部分。
 30Atlas 第一篇[ScriptManager]
 31Atlas 第一篇[ScriptManager]EnablePartialRendering:这个属性用来表示是否激活部分生成。部分生成用来只重新加载部分页面。如果为“真”的话,那么异步控件的常规回发就只显示发送给客户端的增量变化。 
 32Atlas 第一篇[ScriptManager]EnableScriptComponents:这个属性用来控制Atlas的哪一部分在默认情况下可以用在客户端上。它会确定用于用户界面组件、行为、行为绑定和XML脚本编写的Atlas脚本在默认情况下是否可以被下载到客户端上。如果为“伪”的话,你可以在ScriptReference元素里下载具体的组件。 
 33Atlas 第一篇[ScriptManager]ScriptReference:这个元素(它必须被包括在Scripts元素里)让你可以能够添加没有自动包括进来的脚本。脚本要用Path属性来指定,你还可以用Browser属性来为脚本指定一个浏览器。Atlas的确包括一些在默认情况下不会被发送给客户端的脚本;这些脚本可以用ScriptName脚本来添加。这样的脚本包括AtlasUIDragDrop、AtlasUIGlitz和AtlasUIMap。 
 34Atlas 第一篇[ScriptManager]ServiceReference:这个元素可以让你指定要被用在页面脚本里的Web服务。Type属性可以是任何合法的MIME类型。GenerateProxy属性让你能够临时中止为Scripts集合里列出的服务生成代理对象。 
 35Atlas 第一篇[ScriptManager]列表B里的Web页面使用了一个本地Web服务(尽管这个服务可以是任何服务):
 36Atlas 第一篇[ScriptManager]
 37Atlas 第一篇[ScriptManager]<%@ Page Language="C#" %>
 38Atlas 第一篇[ScriptManager]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 39Atlas 第一篇[ScriptManager]"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 40Atlas 第一篇[ScriptManager]<html xmlns="http://www.w3.org/1999/xhtml" >
 41Atlas 第一篇[ScriptManager]<head id="hd">
 42Atlas 第一篇[ScriptManager]<title>TR Sample</title>
 43Atlas 第一篇[ScriptManager]<atlas:ScriptManager ID="scriptManager" runat="server" 
 44Atlas 第一篇[ScriptManager]EnablePartialRendering="false"
 45Atlas 第一篇[ScriptManager]EnableScriptComponents="false" >
 46Atlas 第一篇[ScriptManager]<Services>
 47Atlas 第一篇[ScriptManager]<atlas:ServiceReference Path="testService.asmx" GenerateProxy="true"聽 />
 48Atlas 第一篇[ScriptManager]</Services>
 49Atlas 第一篇[ScriptManager]<Scripts>
 50Atlas 第一篇[ScriptManager]<atlas:ScriptReference Path="AtlasRuntime.js" />
 51Atlas 第一篇[ScriptManager]</Scripts>
 52Atlas 第一篇[ScriptManager]</atlas:ScriptManager>
 53Atlas 第一篇[ScriptManager]<script type="text/javascript">
 54

相关文章:

  • 2021-09-27
  • 2021-11-19
  • 2022-01-12
  • 2022-02-05
  • 2021-07-21
  • 2021-12-05
猜你喜欢
  • 2021-09-24
  • 2021-06-01
  • 2021-12-21
  • 2021-11-17
  • 2022-12-23
  • 2021-08-15
相关资源
相似解决方案