Partial-page rendering

来源:互联网 发布:禁止mac地址访问 编辑:程序博客网 时间:2024/05/17 01:21

asp.net AJX提供了 Partial-page rendering的技术,比如使用update panel可以轻松的实现这个技术,有时候我们叫做无页面刷新技术,这个技术的好处呢?除了用户体验以外,还可以节省带宽,但是,请注意,它节省的是postback之后的一点下传带宽。

msdn里面这样说:

 Partial-page rendering removes the need for the whole page to be refreshed as the result of a postback. Instead, only individual regions of the page that have changed are updated. As a result, users do not see the whole page reload with every postback, which makes user interaction with the Web page more seamless. ASP.NET enables you to add partial-page rendering to new or existing ASP.NET Web pages without writing client script.

By default, postbacks that originate from controls inside the update panel (child controls) automatically initiate asynchronous postbacks and cause a partial-page update

 

An asynchronous postback behaves much like a synchronous postback. All the server page life-cycle events occur, and view state and form data are preserved. However, in the rendering phase, only the contents of the UpdatePanel control are sent to the browser. The rest of the page remains unchanged.

当然,这些都是在postback之后发生的,页面第一次访问或者get方法的时候,其实页面的大小基本上没有变化。

所以,可以看出,只是下传的东西少了,上传的或者get访问的时候页面大小没有少,而其实在asp.net里面,上传的东西缺省还是不少的,在很多情况下,尤其是他为了让我们可以得到一种类似cs编程的开发体验,实现事件驱动的编程方式,大量的使用viewstate来在浏览器和服务器之间保存控件状态。

 

asp.net2.0提供了优化viewsate的处理方法,可以参考我的上一片文章。

 

原创粉丝点击