Dflying Chen @ joycode

Be an evangelist here.
随笔 - 18, 评论 - 142, 引用 - 1

导航

关于

本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。
欢迎到我的博客园Blog看看,其中内容非常丰富哦:)

标签

每月存档

最新留言

广告

在PHP中使用ASP.NET AJAX

借助于CodePlex上开源项目PHP for Microsoft AJAX Library的帮助,我们已经可以在PHP上使用ASP.NET AJAX的很多核心功能了。

 

下载安装

PHP for Microsoft AJAX Library目前仅仅处于Alpha阶段,想实际使用似乎还早了点,只能尝鲜了。

预先需求有PHP 5.2版本,且必须安装了php-json模块。

下载地址:http://www.codeplex.com/phpmsajax/Release/ProjectReleases.aspx?ReleaseId=1692

安装方法:

  1. 下载PHP for Microsoft AJAX Library并解压缩
  2. 下载Microsoft AJAX Library(http://ajax.asp.net
  3. 在PHP Web Service代码中include一下MSAjaxService.php。
  4. 在调用该Web Service的页面中,引入MicrosoftAjax.js文件。

下面来看一个“经典”的场景:调用服务器端方法取得复杂类型。

 

编写Service文件

新建一个php文件,命名为EmployeeService.php。首先写上这一句,include必要的支持代码:

require_once 'MSAjaxService.php';

 

然后定义一个Employee类。四个属性一目了然,不用多说:

class Employee
{
    public $Id;
    public $Name;
    public $Email;
    public $Salary;
 
    function __construct($id, $name, $email, $salary)
    {
        $this->Id = $id;
        $this->Name = $name;
        $this->Email = $email;
        $this->Salary= $salary;
    }
}

 

接下来是EmployeeService类,继承与MSAjaxService.php中的MSAjaxService基类。其中定义一个方法,用来返回一个Employee对象:

class EmployeeService extends MSAjaxService
{
    function GetEmployee()
    {
        return new Employee(12345, "Dflying Chen", "Dflying@some.com", 1000);
    }
}

 

然后新建一个EmployeeService的实例,并且调用基类的ProcessRequest()方法,处理该请求:

$theService = new EmployeeService();
$theService->ProcessRequest();

 

大功告成!

 

编写调用页面

新建一个页面,php或者html均可——程序比较简单。这回我们没了ScriptManager的帮助,引入ASP.NET AJAX客户端脚本文件以及上面的这个Service只能靠手工了。注意EmployeeService.php/js可以得到该Service的客户端代理,和ASP.NET平台上的语法一样:

<head>
    <title>ASP.NET AJAX On PHP Demo</title>
    <script type="text/javascript" src="MicrosoftAjaxLibrary/MicrosoftAjax.js"></script>
    <script type="text/javascript" src="EmployeeService.php/js"></script>
</head>

 

程序的UI部分很简单,按钮用来触发异步调用,<div />用来显示调用结果:

<body>
    <input id="btnGetEmployee" type="button" 
        value="Get an Employee" onclick="return btnGetEmployee_onclick()" />
    <div id="resultDiv">
    </div>
</body>

 

在该按钮的click事件处理函数中,调用该Service,语法也和ASP.NET AJAX中一致,非常方便:

function btnGetEmployee_onclick()
{
    EmployeeService.GetEmployee(onSucceeded);
}

 

在回调函数中,把得到的Employee对象显示到resultDiv中:

function onSucceeded(result)
{
    var sb = new Sys.StringBuilder("Server returns an Employee object: <br />");
    sb.append("Id: " + result.Id + "<br />");
    sb.append("Name: " + result.Name + "<br />");
    sb.append("Email: " + result.Email + "<br />");
    sb.append("Salary: " + result.Salary + "<br />");
 
    $get("resultDiv").innerHTML = sb.toString();
}

 

大功告成!

 

示例程序界面

第一次访问

 

点击Get an Employee按钮后

 

示例程序代码下载

在这里呢:ASPNETAJAXOnPHP.zip

 

好一阵子没用PHP了,生疏了不少。不过照猫画虎还是做出来了,这个项目我觉得非常有前途,各位朋友不妨参与一下。这一段比较忙,没写什么技术文章,这一篇也是草草而为,请朋友们见谅。

posted on 2007-04-19 00:51:00 by dflying  评论(1) 阅读(6205)

《ASP.NET AJAX程序设计 第I卷 服务器端ASP.NET AJAX Extensions与ASP.NET AJAX Control Toolkit》连载&最新更新

本书已经正式出版,请参考:《ASP.NET Ajax程序设计-第I卷:服务器端ASP.NET 2.0 AJAX Extensions与ASP.NET AJAX Control Toolkit》2007年4月16日 china-pub全国首发!+ 赠书名单已经确定

感谢朋友们的关注、支持与谩骂。如果不出意外的话,下周三《ASP.NET AJAX程序设计 第I卷 服务器端ASP.NET AJAX Extensions与ASP.NET AJAX Control Toolkit》即可在各大网上书店购买,下周末即可在书店看到。特别感谢开心大哥百忙中为本书作序。

 

内容介绍

本卷从最易于理解和使用的部分入手,介绍ASP.NET AJAX框架中能够与传统ASP.NET无缝对接的服务器端部分,包括服务器端ASP.NET AJAX Extensions与ASP.NET AJAX Control Toolkit。这部分内容不需要读者任何的客户端开发知识,只要在Visual Studio中拖拖拽拽即可实现强大的客户端Ajax功能,例如局部页面更新、异步回送、拖拽、动画等,非常适合为现有的ASP.NET 2.0应用程序添加少量的Ajax特性,或是基于ASP.NET 2.0的一些简单Ajax功能的实现。

本卷适合对ASP.NET AJAX有兴趣,并希望对其有更进一步了解的Web开发人员阅读。

 

相关信息

CSDN读书频道连载:http://book.csdn.net/bookfiles/326/

人民邮电出版社和我的赠书活动(朋友们抓紧,现在还有机会,但活动即将结束):http://www.turingbook.com/getajaxbooks/

Dearbook网上书店购买:http://dearbook.com.cn/book/170338

China-pub网上书店购买:http://www.china-pub.com/computers/common/info.asp?id=34372

图书编写的心路历程:http://www.cnblogs.com/dflying/archive/2007/04/03/697606.html

第二卷的章节计划(欢迎各位不吝给出意见):http://www.cnblogs.com/dflying/archive/2007/03/27/689714.html

posted on 2007-04-14 07:51:00 by dflying  评论(4) 阅读(7430)

《ASP.NET AJAX程序设计 第I卷》的心路历程

4/4更新:赠书活动已经开始,请到这里了解详情


06年3月份,我终于鼓足勇气,在博客园开始了自己的Blog生涯。当时恰逢微软公司的ASP.NET AJAX(开发代号:Atlas)处于CTP阶段,加之业界对Ajax的热情高涨,于是我开始记下一些ASP.NET AJAX在我实际开发/使用中的心得体会。谁知无心栽柳间却得到了众多朋友的关注和支持,于是Blog中的ASP.NET AJAX相关内容一发不可收拾……

转眼间到了06年7月份,人民邮电出版社图灵公司的傅志红老师联系到了我,并给了我翻译第一本ASP.NET AJAX著作(《Atlas基础教程》)的宝贵机会。诚惶诚恐中我开始了第一次真正意义上的“写作生活”……昏天暗地的三个月后,在人民邮电出版社图灵公司和我的共同努力下,《Atlas基础教程》翻译本终于如期面世,半个月的时间首印5000册即告售罄,并荣登Dearbook当月销售榜第二……

可是喜悦总是短暂的,正当我们踌躇满志准备重印的时候,ASP.NET AJAX由CTP转为Beta。噩耗袭来,《Atlas基础教程》一瞬间便成了废纸,重印更是便成了空中楼阁……由此我也“荣获”了2006年CSDN读书频道“百折不挠奖”

…………

 

回溯到06年8月,那是我刚刚完成了《Atlas基础教程》的翻译工作,信心爆棚并信誓旦旦地开始准备编写我自己的原创ASP.NET AJAX图书。年少轻狂、好大喜功的我并不知道写书的艰辛,更是忘乎所以地没有意识到当时ASP.NET AJAX正处于巨变的前夜,洋洋洒洒列出了30多章的一本大书,1000多页的计划。然后还写出了一篇条理清晰的策划,摆事实讲道理让图灵公司同意了我的出版请求。

…………

 

随着时间的推移,我越发感到这本大书的分量,偶尔平静下来,也似乎隐约能够体会到表面平静的ASP.NET AJAX CTP下面隐藏的暗流。感谢同事Xiang YU的苦心劝说,在06年9月份,我决定将这本大书拆分成三卷,以求规避可能发生的风险,并再次用一篇“不容争辩”的策划说服了图灵公司。

没日没夜的06年十一七天长假之后,《ASP.NET Atlas程序设计:第I卷 服务器端》初稿完成。但ASP.NET AJAX仍在CTP中驻足不前,满怀欣喜的我对此并不在乎,抱着第一卷能在06年出版的幻想,立即投入到第二卷的撰写中……

…………

 

“出来混的,迟早要还”。该来的事情还是来了,虽然我曾想到可笑的分卷“规避”——06年10月末,ASP.NET AJAX一夜间从CTP转为了Beta,其改动之大,对我来说不啻于一个晴天霹雳

……

……

无法形容当时的感觉,正如我在《Atlas新版本的发布对我而言无疑是一个晴天霹雳》中写的,“这意味着我和人民邮电出版社图灵公司这三个多月的努力全部付之东流……现在这本书已经没有了任何的参考价值,没有了任何的出版意义……且CTP和Beta 之间的改变如此巨大,让修改原稿几乎成了不可能完成的任务……面对着眼前这一叠厚厚的400多页凝聚了我和出版社心血的成稿,真是让我欲哭无泪,心情沮丧到了极点……”。

好在时间可以治疗一切,朋友们的鼓励也让我逐渐恢复了过来。我开始从头学习曾经那么熟悉,而现在却“面目全非”的ASP.NET AJAX,并开始修改(或者叫重写)我的第一卷书稿

…………

 

06年年末,修改后的第一卷如期完成,想想仍旧可能是国内乃至全球第一本ASP.NET AJAX正式版图书,似乎让我又看到了远方的幻境。我也再一次地松懈了下来……

松懈的日子过得特别快,虽然期间我还翻译了著名的《CSS禅意花园》,不过很快就到了4月份。我还在这里不着急,因为据我了解国外第一本ASP.NET AJAX正式版图书5月份才能出版,做到全球第一本也似乎就是信手拈来么?

…………

 

突然有一天,偶然听到人民邮电出版社的一本ASP.NET AJAX正式版图书即将出版的消息,再次让我重重地摔了一下,第一本梦想再次如泡沫般破碎,自己的松懈也再次酿成苦果……

…………

 

这就是《ASP.NET AJAX程序设计 第I卷 服务器端ASP.NET AJAX Extensions与ASP.NET AJAX Control Toolkit》的故事梗概,其间的酸甜苦辣,所得所失,只有自己才最清楚……不管怎样,一切都过去了。值此新书即将出版的时候,向各位曾经关注过我的朋友真诚地说声谢谢!我也将和图灵公司一起赠送一批新书给购买过《Atlas基础教程》的朋友,略表弥补寸心……具体的赠书活动流程以及相关宣传不日即将出炉,我在Blog上也会随时保持更新。

路漫漫其修远兮,吾将上下而求索……继续写第二卷去了!

4/4更新:赠书活动已经开始,请到这里了解详情

posted on 2007-04-03 02:08:00 by dflying  评论(11) 阅读(6436)

ASP.NET AJAX (Atlas) 拖放(Drag & Drop)功能6种实现方法总结

在Ajax程序中实现传统桌面程序中异常简单的拖放功能却并不是件容易的事情。然而Web上的拖放功能又如此的让人痴迷,所以几乎每个成熟的Ajax类库都提供了自己的一套实现拖放的封装,ASP.NET AJAX (Atlas) 自然也不例外。本文将总结并简要分析ASP.NET AJAX (Atlas) 中拖放功能的6种不同的实现方法,希望能够帮助朋友们选出最适合实际需求的方法。

其中第1到第4种方案,在我的《ASP.NET Ajax程序设计——第I卷:服务器端ASP.NET 2.0 AJAX Extensions与ASP.NET AJAX Control Toolkit》一书中有详细介绍(4月出版),本文中的代码和图示也节选自该书。第5第6种方案,在我的《ASP.NET 2.0 Ajax程序设计——第II卷:客户端Microsoft AJAX Library》一书中将有详细介绍(暂定7月出版)。

不过纵观这些解决方案,我很遗憾的发现,要么是使用简单,可定制能力差,要么就是可定制能力强,但使用起来要写很多代码。希望ASP.NET AJAX (Atlas) 团队能够再接再厉,努力把这个重要功能做得更好。或者我有哪种方法漏掉了,也请朋友们帮忙补充一下。

 

[1] 使用服务器端DragOverlayExtender或客户端DragOverlayBehavior

服务器端的DragOverlayExtender就是靠着客户端DragOverlayBehavior而实现的,前者是后者在服务器端的组件化封装,所以我们将二者放在一起讨论。

这个“拖放”功能很简单,其实这只是个“拖拽”,而没有“投放”。也就是说,你可以随意将某个Panel在页面中拖来拖去,不过却没有什么固定的地方可以“投放”,就像在Windows桌面上拖放某个窗口的位置一样——其实用处不大,也没有提供什么可定制能力。但它使用起来非常简单,也支持将Panel的位置保存在Profile中。

下面是一段DragOverlayExtender的示例代码,至于DragOverlayBehavior的用法,请查看DragOverlayExtender页面生成的HTML代码:

<asp:Login ID="floatLogin" BackColor="white"
  BorderStyle="Solid" BorderColor="black" 
  runat="server">
</asp:Login>
<asp:DragOverlayExtender ID="DragOverlayExtender2" 
  Enabled="true" TargetControlID="floatLogin" 
  runat="server" />

效果如下:

 

[2] 使用服务器端DragPanel

DragPanel是ASP.NET AJAX Control Toolkit中的一个扩展器控件。其功能基本与DragOverlayExtender和DragOverlayBehavior一样,且同样可以保存Panel的位置信息至Profile中。不同之处在于,DragOverlayExtender和DragOverlayBehavior的拖拽实现方式中,鼠标放在整个Panel的任何部分都可以开始拖拽,而DragPanel在进行拖拽时,只有鼠标放在指定的DragHandle(类似于Windows窗口的标题栏部分)中才能开始拖拽。

对于DragHandle的扩展性和实用性,同样不敢恭维。

下面是一段示例代码:

<asp:Panel ID="floatPanel" CssClass="floatPanel" runat="server">
    <asp:Panel ID="floatPanelHandle" CssClass="handle" runat="server">
        窗口的拖动
    </asp:Panel>
    <div class="content">
        在Windows中,对窗口的拖动似乎成了我们习以为常的事情。
        ………………
        ………………
        Window窗口的表现行为一样。
    </div>
</asp:Panel>
<ajaxToolkit:DragPanelExtender ID="dpe" TargetControlID="floatPanel" 
    DragHandleID="floatPanelHandle" runat="server">
</ajaxToolkit:DragPanelExtender>

效果如下:

 

[3] 使用服务器端ReorderList

ASP.NET AJAX Control Toolkit中的ReorderList控件将在页面中呈现出一个由数据绑定自动生成的条目列表。用户可以通过鼠标拖动某一项来直接改变该列表中条目彼此之间的相对位置关系,且在拖动的过程中,ReorderList控件提供了丰富的、可定制的视觉效果。当用户在某个位置放开鼠标之后,ReorderList控件也将同样会自动通知与其绑定的数据源控件,以Ajax的异步或整页回送的同步方式更新服务器端数据。

ReorderList控件的使用比较简单(服务器端控件),功能也相当的丰富,扩展能力也不错。不过仍称不上最灵活,比如我们想把条目在多个ReorderList之间拖放,那么就没办法实现了——因此,不要指望它能实现WebPart那样的功能。

下面是一段示例代码:

<ajaxToolkit:ReorderList ID="musicList" CssClass="musicList" 
  DragHandleAlignment="Left" PostBackOnReorder="false" 
  DataSourceID="musicDataSource" DataKeyField="Id" 
  SortOrderField="Order" runat="server">
    <ItemTemplate>
        <ajaxToolkit:Rating ID="rating" runat="server" 
           CssClass="rating" StarCssClass="ratingStar" 
           FilledStarCssClass="filledRatingStar" EmptyStarCssClass="emptyRatingStar" 
           CurrentRating='<%# Bind("Rating") %>' MaxRating="5" 
           ReadOnly="true">
        </ajaxToolkit:Rating>
    </ItemTemplate>
    <ReorderTemplate>
        <div class="dragDue">
            Drop Here!
        </div>
    </ReorderTemplate>
    <DragHandleTemplate>
        <asp:Label ID="lbTitle" CssClass="dragHandle" 
           ToolTip="Drag Me!" runat="server" Text='<%# Bind("Name") %>'>
        </asp:Label>
    </DragHandleTemplate>
</ajaxToolkit:ReorderList>

效果挺酷的:

 

[4] 使用UpdatePanel与ASP.NET AJAX中的新版本WebPart控件

ASP.NET 2.0中的WebPart相关的控件虽然非常丰富,易于使用且功能强大,我们在程序中也很需要它所提供的拖拽功能,但它却存在着两个致命的缺陷:

  1. 拖放功能只支持IE浏览器。
  2. 每次用户通过拖放改变配件的位置之后,页面总会自动进行回送以保存当前的设定。

其中第一个问题可以通过ASP.NET AJAX中的新版本WebPart控件搞定,第二个问题可以通过添加UpdatePanel搞定,本来在CTP版本中的ASP.NET AJAX里面,这些功能均已经完美实现了。谁知道在最新的Futures CTP中,却又不好用了。

既然现在已经不能用了,也就没必要分析其优点缺点了。不过还是给出一张截图吧,缅怀一下曾经的辉煌(注意,这可是在Firefox中啊!)……

 

[5] 使用客户端DragDropList

DragDropList定义于ASP.NET AJAX Futures CTP中,功能非常强大,且全部在客户端实现,给服务器端减轻了不少的压力。使用DragDropList实现第4种解决方案中的WebPart类似的效果完全没有问题,不过唯一让人感到遗憾的就是,其扩展功能不是很好,用户虽然可以随便将某个Panel从一个区域拖到另一个区域,但拖拽的结果却很难持久化下来……且使用起来也不是那么的容易,效率上更是不敢恭维……总之,这是个很让人矛盾的东西,有些鸡肋的感觉。

我曾经在《使用ASP.NET Atlas实现拖放(Drag & Drop)效果(下)》这篇文章中给出过DragDropList的示例程序,虽然是基于CTP版本的ASP.NET AJAX ,不过实际上并不需要多少修改就能运行于最新版本之上。感兴趣的朋友可以看看,也可以到官方论坛上搜索一下相关的主题。

 

[6] 在客户端自行实现IDragSource和IDropTarget接口

来到了这个解决方案,可以说你对ASP.NET AJAX中的拖拽实现有了一个较深入的了解。上面的DragDropList其实就是实现了IDragSource和IDropTarget接口,其中前者用来定义可以被拖拽的项目,后者用来定义可以被投放的区域。详细理论上的说明,可以参考我的文章《使用ASP.NET Atlas实现拖放(Drag & Drop)效果(上)》,虽然目前已经有所变化,不过仍可以参考。

这种实现方案应该说是最为强大的了,想要什么功能,肯定都能实现。不过实际开发中的难度也不小——甚至可以说是相当复杂,Jeff Prosise的这篇文章《Implementing Drag-Drop in ASP.NET AJAX》给出了一个非常简单的示例程序,感兴趣想要学习的朋友不妨看看……

posted on 2007-03-26 14:29:00 by dflying  评论(12) 阅读(10282)

更加全面的ASP.NET AJAX(Atlas)学习、参考资源(英文)

前面几天我总结了一些ASP.NET AJAX(开发代号Atlas)重要参考资源大收集,近来偶尔发现了一个英文站点,也总结了一下ASP.NET AJAX(Atlas)的学习资源。粗略看了一下,比我前一个总结的内容丰富多了,实在不敢独享,搬过来希望能和朋友们分享。

注意,下面有些内容是针对CTP版本的ASP.NET AJAX,现在已经有些过时,还请朋友们多加小心,去伪存真。

 

ASP.NET AJAX Quick Start

  1. Definition: ASP.NET (SearchSQLServer.com)
  2. Definition: Ajax (SearchVB.com)
  3. Definition: Atlas (SearchVB.com)
  4. Podcast: Mike Gunderloy on the pros and cons of Atlas (SearchVB.com)
  5. Download: ASP.NET AJAX v1.0 beta (Microsoft)
  6. Overview: ASP.NETAJAX (Microsoft)
  7. Tutorial: "Hello World" in Atlas (Coding Atlas)

 

ASP.NET AJAX Basics

  1. Article: A Primer on Microsoft Atlas (Ajax World)
  2. Tutorial: An Introduction to Ajax and Atlas with ASP.NET 2.0 (Erich Peterson, 4guysfromrolla.com)
  3. Tutorial: Asynchronous Communication Layer Overview (Microsoft)
  4. Tutorial: Partial-Page Rendering Overview (Microsoft)
  5. Tutorial: How to install ASP.NET AJAX (Microsoft)
  6. Tutorial: Tips for new ASP.NET AJAX users (Microsoft)
  7. Tutorial: Common ASP.NET AJAX development scenarios (Microsoft)
  8. Download: ASP.NET AJAX sample applications (Microsoft)

 

ASP.NET AJAX Tutorials

  1. Tutorial: Atlas at last! (Adnan Farooq Hashmi) -- Part 1 | Part 2 | Part 3
  2. Tutorial: Beginning Atlas series: Why Atlas? (Omar Al Zabir)
    Introduction | Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
  3. Tutorial: ASP.NET Atlas Powers the AJAX-Style Sites You've Been Waiting For (Microsoft)
  4. Tutorial: Enhancing Existing Applications with ASP.NET AJAX Extensions (Microsoft)
  5. Tutorial: Using the UpdatePanel Control in ASP.NET AJAX Applications (Microsoft)
  6. Tutorial: Customizing Partial-Page Rendering with Client Scripting (Microsoft)
  7. Tutorial: Using Timer Control to Enable Partial-Page Updates (Microsoft)
  8. Tutorial: Creating Custom Client Scripts in ASP.NET AJAX (Microsoft)
  9. Tutorial: Call a Web Service from JavaScript using Server Types (Microsoft)
  10. Tutorial: Making JavaScript easier (Microsoft)
  11. Tutorial: Performing data access (Microsoft)
  12. Tutorial: Controls and UI (Microsoft)
  13. Tutorial: Call a Web Service with ASP.NET AJAX without writing client-side scripts (Fredrik Normen)
  14. Tutorial: Using Atlas with PHP (Shanku Niyogi)
  15. Tutorial: Update Panel: Having fun with errors (Luis Abreu)
  16. Tutorial: What's up with UpdatePanels and how come nothing works? (Eilon Lipton)
  17. Tutorial: Cool UI Templating Technique to use with ASP.NET AJAX for non-UpdatePanel scenarios (Scott Guthrie)
  18. Tutorial: Write controls compatible with UpdatePanel without linking to the ASP.NET AJAX DLL (Eilon Lipton)
  19. Tutorial: Sliding Task Lists project -- Building an Atlas application from a scratch (Coding Atlas)
  20. Tutorial: Sliding Task Lists project (day 1) -- Building a user interface (Coding Atlas)
  21. Tutorial: Sliding Task Lists project (day 2) -- Implementing ASP.NET 2.0 membership provider (Coding Atlas)
  22. Tutorial: Sliding Task Lists project (day 3) -- Using ModalPopup extender to create panels for adding new tasks (Coding Atlas)
  23. Tutorial: Sliding Task Lists project (day 4) -- Database tables and saving new tasks with Atlas (Coding Atlas)
  24. Tutorial: Sliding Task Lists project (day 5) -- Reorder Lists and client side update panel refresh (Coding Atlas)

 

ASP.NET AJAX Articles and References

  1. Article: Atlas renamed ASP.NET AJAX, to ship by end of year (SearchVB.com)
  2. Article: Atlas: Think before you lift (SearchVB.com)
  3. Article: Microsoft unleashes Atlas at MIX06 (SearchVB.com)
  4. Article: Atlas means "Ajax for the masses" (SearchVB.com)
  5. Article: Microsoft's Atlas -- Ajax in a box (Way.Nu)
  6. Article: Atlas Programming Model (Nikhil Kothari)
  7. Article: InPlaceEditing with Atlas Behaviors (Nikhil Kothari)
  8. Article: InPlaceEditing - Implementing Script Behaviors in Atlas (Nikhil Kothari)
  9. Article: Back Button Support for Atlas UpdatePanels (Nikhil Kothari)
  10. Article: Script Loading Tips (Nikhil Kothari)
  11. Article: Using Atlas Update Panel Server Control (Code4Vista)
  12. Article: From closures to prototypes (Bertrand Le Roy) -- Part 1 | Part 2
  13. Article: How to add Atlas to an existing site (Jay Kimble, CodeBetter.com)
  14. Article: Add "Atlas" controls to the Visual Studio 2005 Toolbox (Public Sector Developer Weblog)
  15. Article: Dragging and dropping with ASP.NET 2.0 and Atlas (The Code Project)
  16. Article: Implementing Ajax Using ASP.NET 1.1 (15 Seconds)
  17. Reference: ASP.NET AJAX client class library (Microsoft)
  18. Reference: Client-Side Type System & Reflection API Overview (Microsoft)
  19. Reference: Client-Side Error Type Extensions API Overview (Microsoft)
  20. Reference: ASP.NET AJAX server class library (Microsoft)

 

ASP.NET AJAX "How Do I?" Videos

  1. Get Started with Atlas: Watch | Download
  2. Get Started with the Atlas Control Toolkit: Watch | Download
  3. Use the Atlas CascadingDropDown Control Extender: Watch | Download
  4. Implement Dynamic Partial-Page Updates with Atlas: Watch | Download
  5. Make Client-Side Network Callbacks with Atlas: Watch | Download
  6. Write a Custom Atlas Control Extender: Watch | Download
  7. Add Atlas Features to an Existing Web Application: Watch | Download
  8. Atlas Enable an Existing Web Service: Watch | Download
  9. Use the Atlas TextBoxWatermark Control Extender: Watch | Download
  10. Use the Atlas Popup Control Extender: Watch | Download
  11. Use the Atlas ModalPopup Extender Control: Watch | Download
  12. Use the Atlas AlwaysVisible Control Extender: Watch | Download
  13. Use the Atlas Accordion Control: Watch | Download
  14. Use the Atlas Client Library Controls: Watch | Download
  15. Use the Atlas Collapsible Panel Extender: Watch | Download
  16. Use the Atlas Draggable Panel Extender: Watch | Download
  17. Build a Mashup using Microsoft Atlas: Watch | Download
  18. Use the Atlas DynamicPopulate Extender: Watch | Download
  19. Use the Atlas FilteredTextbox Extender: Watch | Download
  20. Use the ASP.NET AJAX HoverMenu Extender: Watch | Download
  21. Use the ASP.NET AJAX ToggleButton Extender: Watch | Download
  22. Use an ASP.NET AJAX ScriptManagerProxy: Watch | Download
  23. Use the ASP.NET AJAX DropShadow Extender: Watch | Download
  24. Use the ASP.NET AJAX PasswordStrength Extender: Watch | Download
  25. Use the ASP.NET AJAX RoundedCorners Extender: Watch | Download

 

More Webcasts and Videos

  1. Webcast: Creating a customer view with Atlas (Wahlin Consulting)
  2. Webcast: Simplifying XMLHTTP programming with ASP.NET Atlas (Channel 9) -- Part 1 | Part 2
  3. Webcast: Enabling Partial Page Updates with the ASP.NET Atlas UpdatePanel (Channel 9)
  4. Webcast: Attaching Client Functionality to ASP.NET Server Controls using ASP.NET Atlas (Channel 9)
  5. Webcast: AJAX Enabling ASP.NET 2.0 Web Parts with Atlas (Channel 9)
  6. Video: Atlas Technical Overview (Microsoft)
  7. Video: Mashup 101: Virtual Earth -- Part 1 | Part 2 (Microsoft)
  8. Video: Control Toolkit (Microsoft)
  9. Video The Ajax Experience (Microsoft)
  10. Video: Technology Preview (Microsoft)
  11. Video: Application Demos (Microsoft)
  12. Video: First Look (Microsoft)

 

Working with ASP.NET AJAX Controls

  1. ASP.NET AJAX Control Toolkit home page (Microsoft)
  2. Article: With Microsoft's Atlas toolkit, no wait for Ajax controls (SearchVB.com)
  3. Article: Atlas Control Toolkit: A large, open-source framework (SearchVB.com)
  4. Article: Atlas Control Toolkit (And Why It Is Really Cool) (Scott Guthrie)
  5. Article: Testing the Toolkit (Shawn Burke)
  6. Article: Free Atlas Control Toolkit Test Automation Harness Published (Scott Guthrie)
  7. Control: Introducing Drag-Drop and Animations with Microsoft Atlas (Shiju Varghese)
  8. Control: Microsoft Atlas Control Extender -- Focus (Chris Crowe)
  9. Control: Master / Detail drop down lists -- client side data binding (Coding Atlas)
  10. Control: Always visible loading image (Coding Atlas)
  11. Control: ReorderList control (Coding Atlas)
  12. Control: Atlas ScriptManager Control (Nikhil Kothari)
  13. Control: TextBoxCounter Atlas Extender (Scott Cate)
  14. Control: Atlas PasswordStrength Display Extender control (Paul Glavich)
  15. Control: UpdateProgress Control and Ajax Activity Image Animations (Scott Guthrie)
  16. Tutorial: Working with Atlas Control Toolkit (ASPAlliance.com)
  17. Tutorial: Dynamic content made easy (How to use the new dynamic population support for Toolkit controls) (Delay's Blog)
  18. Tutorial: Building a Mashup using the Atlas Virtual Earth Map control (Jonathan Hawkins)

 

General Ajax Resources

  1. Article: Ajax development: The what, how and when (SearchVB.com)
  2. Article: Ajax development: The what, how and when, continued -- Five tips for getting started (SearchVB.com)
  3. Article: 2005 in review: Ajax makes news, but will it make the grade? (SearchVB.com)
  4. Article: Ajax hype and reality (SearchWebServices.com)
  5. Article: Can Ajax be running partner of Web services? (SearchWebServices.com)
  6. Article: Ajax and interface design (Luke Wroblewski)
  7. Quiz: Ajax quiz: Do you speak geek? (WhatIs.com)
  8. Reference: Ajax Learning Guide (SearchVB.com)
  9. Reference: Comparison of Ajax frameworks for ASP.NET (Daniel Zeiss)
  10. Tutorial: Populating a DropDownList using Ajax and ASP.NET (ASPAlliance)

 

ASP.NET AJAX Forums and Blogs

  1. Where peers share know-how and experience: ITKnowledge Exchange (SearchVB.com)
  2. Forum: AJAX Discussion and Suggestions (ASP.NET Forums)
  3. Forum: AJAX UI (ASP.NET Forums)
  4. Forum: AJAX Networking and Web Services (ASP.NET Forums)
  5. Forum: Atlas general questions (DotNetSlackers)
  6. Forum: Atlas code samples (DotNetSlackers)
  7. Blog: ASP.NET AJAX Blog Roll (Microsoft)

posted on 2006-11-26 11:19:00 by dflying  评论(6) 阅读(9270)

ASP.NET AJAX(Atlas)和Anthem.NET——管中窥豹般小小比较

Anthem.NET近日有朋友和我提到Anthem.NET这个同样基于ASP.NET的Ajax框架,今天有机会亲自尝试了一下。初步的感觉似乎和ASP.NET AJAX不相上下,甚至某些地方要强于ASP.NET AJAX。当然,半个小时的尝试不能算作什么,这篇文章的很多比较结论可能只是因为我的“无知”造成的,取名“管中窥豹”,其意正在如此。

Anthem.NET的主页在这里,提供了下载文件以及大量的示例程序。同时,博客园的木野狐兄弟也写了一些很好的关于Anthem.NET的文章,值得我们学习(希望木野狐兄弟再接再厉啊!)。

本文将分别用ASP.NET AJAX和Anthem.NET实现一个最最最最简单的Ajax应用,即:页面中一个Button一个Label,点击Button将在服务器端设置Label中的Text,当然,这一切都是以Ajax异步回送的方式进行的。并比较这两种实现方式的编写代码、生成客户端脚本大小、执行效率等。

 

ASP.NET AJAX程序代码

我想,对于ASP.NET AJAX这部分内容,大家已经非常熟悉了:ScriptManager和UpdatePanel而已:

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
    <asp:Button ID="btnSetText" runat="server" Text="Set Text" OnClick="btnSetText_Click" />
    <asp:UpdatePanel ID="up1" runat="server">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSetText" EventName="Click" />
        </Triggers>
        <ContentTemplate>
            <asp:Label ID="lbText" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
</div>

服务器端的处理函数也很简单:

protected void btnSetText_Click(object sender, EventArgs e)
{
    lbText.Text = "This text is set on server side.";
}

大功告成!

 

Anthem.NET程序代码

将Anthem.dll拷贝到Web Site的bin文件夹下,然后在web.config的<configuration>\ <system.web>\ <pages>\ <controls>中添加如下一行,注册Anthem.NET控件:

<add tagPrefix="anthem" namespace="Anthem" assembly="Anthem"/>

Anthem.NET页面不用添加ScriptManager,而是提供了一套自己就带有Ajax功能的、继承于现有ASP.NET控件的服务器端控件。根据上面在web.config文件中的注册,这部分控件的前缀为anthem。

Anthem.NET程序的页面显得非常简单:

<div>
    <anthem:Button ID="btnSetText" runat="server" Text="Set Text" OnClick="btnSetText_Click" />
    <anthem:Label ID="lbText" runat="server" />
</div>

服务器端的处理函数比ASP.NET AJAX的多出一行,明确指出需要更新Label中的内容(这一句其实与ASP.NET AJAX的UpdatePanel有着异曲同工之妙):

protected void btnSetText_Click(object sender, EventArgs e)
{
    lbText.Text = "This text is set on server side.";
    lbText.UpdateAfterCallBack = true;
}

似乎更加简单!

 

运行结果

两个示例程序运行结果完全一致:点击按钮将执行一次异步回送,然后Label中将显示出服务器端设定的文字。

 

ASP.NET AJAX和Anthem.NET实现方式的比较

一样的功能,但是却有比较:

 

结论

了解还不够深入,结论先不下了……上面的数据似乎可以说明一些问题,所谓滴水藏海啊! 

posted on 2006-11-22 15:37:00 by dflying  评论(20) 阅读(9043)

ASP.NET AJAX(开发代号Atlas)重要参考资源大收集

英文网站部分

  1. http://www.google.com 或者http://search.msn.com :不必多说
  2. ASP.NET AJAX官方网站:不用多说了……
  3. ASP.NET AJAX Control Toolkit官方网站:同样不必多说……
  4. 官方参考文档:必备资料,虽然现在还不是很全。
  5. 官方讨论社区:直接和ASP.NET AJAX顶级开发者以及ASP.NET AJAX开发组成员交流,得到他们的建议并提交反馈。ASP.NET AJAX的最新动态、最新问题基本都是从这里散发出去的。
  6. Scott Guthrie的Blog的Atlas分类:ASP.NET之父的Blog,更新非常频繁,及时带来最新的官方消息。
  7. Nikhil Kothari的Blog的ASP.NET分类:Atlas架构师的Blog,更新不是很多,但是内容足够深入。
  8. [RSS Feed]ASP.NET AJAX Team的Blog订阅:ASP.NET AJAX开发团队高层成员的Blog的相关内容的聚合。ASP.NET AJAX最新的动态,最新的使用技巧在这里都能找到。

以下是一些零零碎碎的内容,不成系统,但是空余时间也值得参考:

  1. http://weblogs.asp.net/bleroy/archive/tags/Atlas/default.aspx
  2. http://www.west-wind.com/WebLog/
  3. http://weblogs.asp.net/despos/archive/tags/ASP.NET+AJAX/default.aspx
  4. http://weblogs.asp.net/leftslipper/archive/tags/AJAX/default.aspx

 

中文网站部分

  1. http://www.baidu.com:不必多说
  2. Scott Guthrie 博客中文版的ASP.NET AJAX部分:感谢思归大哥翻译。
  3. 博客园ASP.NET AJAX (Atlas)学习团队:说是国内最全的ASP.NET AJAX学习资源一点都不为过。包含大量各种层次、系列、形式的文章。
  4. 思归的“关注AJAX”系列:文章比较简洁,以引用链接英文文章为主。适合已经入门了的朋友进一步提高。
  5. Jeffrey Zhao的Blog:很多ASP.NET AJAX的相关文章,理论性较强,适合已经入门了的朋友进一步提高。
  6. TerryLee的ASP.NET AJAX入门系列:针对初学者最好的ASP.NET AJAX学习教程。目前还在写作过程中,希望Terry大哥继续努力。
  7. Dflying Chen的Blog的相关分类:入门和高级内容都有涉及,早期CTP版本内容丰富,不过已经过时。最近更新比较频繁。
  8. CSDN的Atlas标签:内容良莠不齐,需要仔细挑选甄别之后再吸收。

 

图书部分

  1. Atlas基础教程:入门书籍,内容针对CTP版本的Atlas,现在已经过时。
  2. (若干本英文图书,加上我的三本,现在尚未出版,暂且不列)

 

附:建议学习过程

  1. [预先需求] 了解AJAX基本原理(随便找本书看看或是搜索一下网络资源)
  2. [入门] TerryLee的ASP.NET AJAX入门系列
  3. [继续入门 稍加深入] ASP.NET AJAX官方网站ASP.NET AJAX Control Toolkit官方网站官方参考文档
  4. [应用 问题求解] Dflying Chen的Blog的相关分类博客园ASP.NET AJAX (Atlas)学习团队官方讨论社区
  5. [深入原理] Jeffrey Zhao的Blog
  6. [把握技术趋势] Scott Guthrie的Blog的Atlas分类Nikhil Kothari的Blog的ASP.NET分类ASP.NET AJAX Team的Blog订阅思归的“关注AJAX”系列
  7. [全程都要用的] http://www.google.comhttp://www.baidu.com
  8. [日常点滴积累] 上述其他资源

 

匆忙写成,定有遗漏疏忽,欢迎朋友们继续补充推荐并对错误不吝指正……人工分类总是比搜索引擎自动进行要精确一些,起码现在如此 :-)

posted on 2006-11-19 23:50:00 by dflying  评论(16) 阅读(8207)

Powered by: Joycode.MVC引擎 0.5.2.0