迁移你的Web页面到ASP.NET AJAX 1.0
点击次数:20 次 发布日期:2008-11-26 11:42:05 作者:源代码网
|
源代码网推荐 源代码网推荐 随着ASP.NET AJAX 1.0 Beta版的发布,带来了很多根本性的变化,其中的一个变化就是从原先的版本中移除了“TargetProperties”对象。 源代码网推荐 源代码网推荐 幸运的是,迁移你的Web页面到新的形式非常的简单,仅仅按照如下步骤去做: 源代码网推荐 源代码网推荐 源代码网推荐 源代码网推荐 第一步:更新引用 源代码网推荐 源代码网推荐 首先程序集Toolkit的名称已经改变,更新你的Web站点的引用从AtlasControlToolkit到AjaxControlToolkit,然后更新你的Web页面中所有的Register指令。 源代码网推荐 源代码网推荐 源代码网推荐 源代码网推荐 <%@ Register 源代码网推荐 源代码网推荐 Assembly="AtlasControlToolkit" 源代码网推荐 源代码网推荐 Namespace="AtlasControlToolkit" 源代码网推荐 源代码网推荐 TagPrefix="atlasToolkit" %> 源代码网推荐 修改为: 源代码网推荐 <%@ Register 源代码网推荐 源代码网推荐 Assembly="AjaxControlToolkit" 源代码网推荐 源代码网推荐 Namespace="AjaxControlToolkit" 源代码网推荐 源代码网推荐 TagPrefix="ajaxToolkit" %> 源代码网推荐 第二步 为每一个属性对象创建Extender实例 源代码网推荐 源代码网推荐 新的ASP.NET AJAX 扩展里面移除了TargetProperties,每个属性现在直接定义为Extender,所以在你原来的代码中每一个属性对象,都需要一个Extender实例。 源代码网推荐 源代码网推荐 <atlasToolkit:ConfirmButtonExtender 源代码网推荐 源代码网推荐 ID="cbe1" runat="server"> 源代码网推荐 源代码网推荐 <atlasToolkit:ConfirmButtonProperties 源代码网推荐 源代码网推荐 TargetControlID="LinkButton1" 源代码网推荐 源代码网推荐 ConfirmText="Delete Item?" /> 源代码网推荐 源代码网推荐 <atlasToolkit:ConfirmButtonProperties 源代码网推荐 源代码网推荐 TargetControlID="LinkButton2" 源代码网推荐 源代码网推荐 ConfirmText="Update Item?" /> 源代码网推荐 源代码网推荐 </atlasToolkit:ConfirmButtonExtender> 源代码网推荐 修改为: 源代码网推荐 源代码网推荐 <ajaxToolkit:ConfirmButtonExtender 源代码网推荐 源代码网推荐 ID="cbe1" runat="server" /> 源代码网推荐 源代码网推荐 <ajaxToolkit:ConfirmButtonExtender 源代码网推荐 源代码网推荐 ID="cbe2" runat="server"/> 源代码网推荐 源代码网推荐 源代码网推荐 第三步 从Extender中移除属性声明 源代码网推荐 源代码网推荐 从属性对象中拷贝属性声明到新的Extender实例。 源代码网推荐 源代码网推荐 <ajaxToolkit:ConfirmButtonExtender 源代码网推荐 源代码网推荐 ID="cbe12" 源代码网推荐 源代码网推荐 runat="server" 源代码网推荐 源代码网推荐 TargetControlID="LinkButton1" 源代码网推荐 源代码网推荐 ConfirmText="Delete Item?" /> 源代码网推荐 源代码网推荐 <ajaxToolkit:ConfirmButtonExtender 源代码网推荐 源代码网推荐 ID="cbe2" 源代码网推荐 源代码网推荐 runat="server" 源代码网推荐 源代码网推荐 TargetControlID="LinkButton2" 源代码网推荐 源代码网推荐 ConfirmText="UpdateItem?" /> 源代码网推荐 源代码网推荐 源代码网推荐 第四步 (可选)迁移ID到BehaviorID 源代码网推荐 源代码网推荐 如果你在属性对象中引用了组件的ID,在Extender中修改它的值为“BehaviorID”。 源代码网推荐 源代码网推荐 源代码网推荐 <atlasToolkit:ConfirmButtonExtender 源代码网推荐 源代码网推荐 ID="cbe1" runat="server"> 源代码网推荐 源代码网推荐 <atlasToolkit:ConfirmButtonProperties 源代码网推荐 源代码网推荐 ID="confirmBehavior1" 源代码网推荐 源代码网推荐 TargetControlID="LinkButton1" 源代码网推荐 源代码网推荐 ConfirmText="Delete?" /> 源代码网推荐 源代码网推荐 </atlasToolkit:ConfirmButtonExtender> 源代码网推荐 源代码网推荐 源代码网推荐 源代码网推荐 <script type="text/javascript"> 源代码网推荐 源代码网推荐 function doSomething() { 源代码网推荐 源代码网推荐 var b = $object("confirmBehavior1"); 源代码网推荐 源代码网推荐 b.confirm(); 源代码网推荐 源代码网推荐 } 源代码网推荐 源代码网推荐 </script> 源代码网推荐 修改为: 源代码网推荐 源代码网推荐 <ajaxToolkit:ConfirmButtonExtender 源代码网推荐 源代码网推荐 ID="cbe1" 源代码网推荐 源代码网推荐 BehaviorID="confirmBehavior1" 源代码网推荐 源代码网推荐 runat="server" 源代码网推荐 源代码网推荐 TargetControlID="LinkButton" 源代码网推荐 源代码网推荐 ConfirmText="Delete?" /> 源代码网推荐 源代码网推荐 源代码网推荐 <script type="text/javascript"> 源代码网推荐 源代码网推荐 function doSomething() { 源代码网推荐 源代码网推荐 var b = $find("confirmBehavior1"); 源代码网推荐 源代码网推荐 b.confirm(); 源代码网推荐 源代码网推荐 } 源代码网推荐 源代码网推荐 </script> 源代码网推荐 源代码网推荐 完成! 源代码网推荐 源代码网推荐 原文:http://ajax.asp.net/ajaxtoolkit/Walkthrough/AtlasToAspNetAjax.aspx 源代码网推荐 http://www.cnblogs.com/Terrylee/archive/2006/10/21/atlas_to_aspnet_ajax.html 源代码网推荐 源代码网推荐 做人要厚道,请注明转自酷网动力(www.ASPCOOL.COM)。 源代码网推荐 源代码网供稿. |
