经常去codeproject的肯定见过,最近上面发布了一套非常好用的Ajax服务器控件目前评价已经很高了
 
51 votes for this article.
一套使用简单的Ajax服务器控件-Anthem.NET 一套使用简单的Ajax服务器控件-Anthem.NET 一套使用简单的Ajax服务器控件-Anthem.NET 一套使用简单的Ajax服务器控件-Anthem.NET 一套使用简单的Ajax服务器控件-Anthem.NET一套使用简单的Ajax服务器控件-Anthem.NET
Popularity: 8.06. Rating: 4.72 out of 5.

一、设计思路简单清晰

我们以往的使用的框架或自己直接使用xmlhttp直接实现Ajax都难免要写一些javascript脚本,而这个最大的亮点(本来想用卖点的,但是人家是开源项目OpenSource project)就是使用时不一定要书写js脚本,使用成本极低,昨天仔细观察了一下他的部分源码,觉得作者的思路的确不错,简单明了;严格意义上讲这不是套框架,而是封装良好的控件,而且感觉比微软将要推出的atlas控件简单,或许使用前几天发布源代码的AjaxPro可以编写出这么一套控件也没什么难的;
 
二、使用简单

以他上面最简单的demo:Introduction using buttons and labels  为例
他的步骤是:
一套使用简单的Ajax服务器控件-Anthem.NETSteps
一套使用简单的Ajax服务器控件-Anthem.NET1.Add a Register directive to the top of your page: 
一套使用简单的Ajax服务器控件-Anthem.NET
一套使用简单的Ajax服务器控件-Anthem.NET
<%@ Register TagPrefix="anthem" Namespace="Anthem" Assembly="Anthem" %>
一套使用简单的Ajax服务器控件-Anthem.NET2.Add an anthem:Button control to your page: 
一套使用简单的Ajax服务器控件-Anthem.NET
一套使用简单的Ajax服务器控件-Anthem.NET
<anthem:Button id="button" runat="server" Text="Click Me!" />
一套使用简单的Ajax服务器控件-Anthem.NET3.Add an anthem:Label control to your page: 
一套使用简单的Ajax服务器控件-Anthem.NET
一套使用简单的Ajax服务器控件-Anthem.NET
<anthem:Label id="label" runat="server" />
一套使用简单的Ajax服务器控件-Anthem.NET4.Add a handler 
for the button's Click event either by double-clicking on the button in the designer or by adding an OnClick attribute to the button's tag: 
一套使用简单的Ajax服务器控件-Anthem.NET
一套使用简单的Ajax服务器控件-Anthem.NET
<anthem:Button id="button" runat="server" Text="Click Me!" OnClick="button_Click" />
一套使用简单的Ajax服务器控件-Anthem.NET5.Implement the handler 
in your code behind class or in a server-side script block in your page. Set the Text property like a normal Label control but make sure you set the UpdateAfterCallBack property to true or you won't see the change reflected on the page: 
一套使用简单的Ajax服务器控件-Anthem.NET
一套使用简单的Ajax服务器控件-Anthem.NET
<script runat="server">
一套使用简单的Ajax服务器控件-Anthem.NET
一套使用简单的Ajax服务器控件-Anthem.NET
void button_Click(object sender, EventArgs e)
一套使用简单的Ajax服务器控件-Anthem.NET[assembly: TagPrefix("Anthem""Anthem")]
也就省了,但是作者为什么不加,不得其解,至于5步的button_Click脚本,可以写到cs脚本中,岂不是与一般控件一样?

三、支持vs2003和vs2005两种版本
代码中有了很多宏,同时支持两个版本!

有兴趣去下来看看,相信能受益……

ps:新建一个技术群19798587,主要交流Ajax&Altas技术

相关文章:

  • 2021-12-06
  • 2021-07-01
  • 2022-01-14
  • 2021-12-09
  • 2021-10-24
  • 2021-06-09
  • 2022-01-02
  • 2021-11-01
猜你喜欢
  • 2021-06-26
  • 2022-01-16
  • 2022-01-02
  • 2022-01-26
  • 2021-09-12
  • 2022-01-27
相关资源
相似解决方案