您的位置:首页 > 其它

一套使用简单的Ajax服务器控件-Anthem.NET

2006-02-22 10:25 417 查看
经常去codeproject的肯定见过,最近上面发布了一套非常好用的Ajax服务器控件目前评价已经很高了

51 votes for this article.
Steps
1.Add a Register directive to the top of your page:

<%@ Register TagPrefix="anthem" Namespace="Anthem" Assembly="Anthem" %>
2.Add an anthem:Button control to your page:

<anthem:Button id="button" runat="server" Text="Click Me!" />
3.Add an anthem:Label control to your page:

<anthem:Label id="label" runat="server" />
4.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:

<anthem:Button id="button" runat="server" Text="Click Me!" OnClick="button_Click" />
5.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:

<script runat="server">

void button_Click(object sender, EventArgs e)

</script>

后来我觉得前1234步其实不需要,在其源码的每个控件命名空间上加上

[assembly: TagPrefix("Anthem", "Anthem")] 也就省了,但是作者为什么不加,不得其解,至于5步的button_Click脚本,可以写到cs脚本中,岂不是与一般控件一样?

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

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

ps:新建一个技术群19798587,主要交流Ajax&Altas技术
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: