在第一个实做中采用的是客户端的HTML组件和客户端脚本实现的客户端界面以及无刷新的功能。
在第二个实战中是通过添加服务器端的组件实现的客户端组件和无刷新功能(这个实做调用的也是第一个实做中的webservice)。
实做二中的ASPX页面的HTML代码如下:
<%@ Page Language="VB" MasterPageFile="~/Default.master" Title="Atlas HOL 2" %>
<asp:Content ID="Content3" ContentPlaceHolderID="Main" Runat="Server">
<form action="">
<div>
Search for
<input id="SearchKey" type="text" />
<input id="SearchButton" type="button" value="Search" />
</div>
</form>
<hr style="width: 300px" />
<div>
<span id="Results"></span>
</div>
<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<references>
<add src="ScriptLibrary/AtlasUI.js" />
<add src="ScriptLibrary/AtlasControls.js" />
</references>
<components>
<textBox id="SearchKey" />

<serviceMethod id="helloService" url="HelloWorldService.asmx"
methodName="HelloWorld">
<bindings>
<binding dataContext="SearchKey" dataPath="text"
property="parameters" propertyKey="query" />
</bindings>
<completed>
<invokeMethod target="resultsBinding"
method="evaluateIn" />
</completed>
</serviceMethod>

<button targetElement="SearchButton">
<click>
<invokeMethod target="helloService" method="invoke" />
</click>
</button>

<label targetElement="results">
<bindings>
<binding id="resultsBinding" dataContext="helloService"
dataPath="response.object" property="text"
automatic="false" />
</bindings>
</label>

</components>
</page>
</script>
</asp:Content>


重点是<page xmlns:script="http://schemas.microsoft.com/xml-script/2005"></page>中的段落,在这个段落中定义了一个<references>段和一个<components>段。其中<references>段中定义的是引用到的客户端JavaScript脚本,<components>段中定义的是用于生成客户端UI、方法调用的XML。这样在以后版本的Atlas中应该就可以直接通过可视的方法创建UI以及定义动作和事件了。
在第二个实战中是通过添加服务器端的组件实现的客户端组件和无刷新功能(这个实做调用的也是第一个实做中的webservice)。
实做二中的ASPX页面的HTML代码如下:
<%@ Page Language="VB" MasterPageFile="~/Default.master" Title="Atlas HOL 2" %>
<asp:Content ID="Content3" ContentPlaceHolderID="Main" Runat="Server">
<form action="">
<div>
Search for
<input id="SearchKey" type="text" />
<input id="SearchButton" type="button" value="Search" />
</div>
</form>
<hr style="width: 300px" />
<div>
<span id="Results"></span>
</div>
<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<references>
<add src="ScriptLibrary/AtlasUI.js" />
<add src="ScriptLibrary/AtlasControls.js" />
</references>
<components>
<textBox id="SearchKey" />
<serviceMethod id="helloService" url="HelloWorldService.asmx"
methodName="HelloWorld">
<bindings>
<binding dataContext="SearchKey" dataPath="text"
property="parameters" propertyKey="query" />
</bindings>
<completed>
<invokeMethod target="resultsBinding"
method="evaluateIn" />
</completed>
</serviceMethod>
<button targetElement="SearchButton">
<click>
<invokeMethod target="helloService" method="invoke" />
</click>
</button>
<label targetElement="results">
<bindings>
<binding id="resultsBinding" dataContext="helloService"
dataPath="response.object" property="text"
automatic="false" />
</bindings>
</label>
</components>
</page>
</script>
</asp:Content>

重点是<page xmlns:script="http://schemas.microsoft.com/xml-script/2005"></page>中的段落,在这个段落中定义了一个<references>段和一个<components>段。其中<references>段中定义的是引用到的客户端JavaScript脚本,<components>段中定义的是用于生成客户端UI、方法调用的XML。这样在以后版本的Atlas中应该就可以直接通过可视的方法创建UI以及定义动作和事件了。
浙公网安备 33010602011771号