All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
visual c++ 中抽象类与纯虚函数的用法
安装并使用phpMyAdmin管理MySQL数据库_php资料_编程技术
SEO网站设计中不可忽略的细节_百度优化_seo学堂
教你轻松给流程增加权限控制程序_.net资料_编程技术
PHP教程:简单学习动态网页制作PHP中的Sessions_[PHP教程]
PHP中 ADODB 类库介绍(二)_[PHP教程]
总结SQL Server与Access语法小差异_[SQL Server教程]
Mysql中limit的用法详解_mssql学习_编程技术
delphiTab 组件(TTabControl)使用实例
IIS运行不了ASP.NET的解决办法_.net资料_编程技术
Reading number is top 10 pictures
鸡蛋的新玩法
不知名的美女素颜照1
随便发几张图
The money of more than 100 countries and regions15
Group of female porn in 《westwards》, uninhibited woman threatened to not the bottom line1
徐若瑄展示美丽胸围1
Chinese paper-cut grilles art appreciation4
The real super beauty2
夕阳下的北京街道
天安门景物系列(一)
Download software ranking
Tram sex maniac 2 (H) rar bag8
Unix video tutorial8
The hero
超级战舰
Sora aoi 120 minutes
dreamweaver8中文版
VC++6.0简体中文版
徐若瑄成名作“魔鬼天使”
apache-tomcat-6.0.33
Tram sex maniac 2 (H) rar bag3
qq published in(发表于) 2014/7/9 1:40:15 Edit(编辑)
在asp.net2.0页面部分缓存中使用PartialCachingAttribu

在asp.net2.0页面部分缓存中使用PartialCachingAttribu

在asp.net2.0页面部分缓存中使用PartialCachingAttribu

使用PartialCachingAttribute类

使用PartialCachingAttribute类定义Web窗体用户控件,用于设置有关控件缓存的配置内容。本节主要讲解PartialCachingAttribute类的6个常用属性和4种类构造函数。6个常用属性是Duration、Shared、SqlDependency、VaryByControl、VaryByCustom和VaryByParam。与19.2节中的@ OutputCache指令设置的6个属性完全相同,但所使用的方式不同。PartialCaching Attribute类中的构造函数和常用属性及说明如表1和表2所示。



表1 PartialCachingAttribute类的构造函数及说明



表2 PartialCachingAttribute类的常用属性及说明

以上介绍了PartialCachingAttribute类的6个属性和4种构造函数。下面通过一个典型示例说明该类的具体应用方法。

本示例使用PartialCachingAttribute类设置用户控件(WebUserControl.ascx文件)的缓存有效期时间是20s。

使用PartialCachingAttribute类实现设置用户控件缓存,必须在用户控件类声明前设置“[PartialCaching(20)]”,代码如下:

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

[PartialCaching(20)] //设置用户控件的缓存时间为20s

public partial class WebUserControl : System.Web.UI.UserControl

{

}

以上代码设置了缓存有效时间为20s。这与在WebUserControl.ascx文件顶部设置@ Output Cache指令的Duration属性值为20是完全一致的。




添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.