随笔分类 -  ASP.NET

摘要:ASP.net缓存主要分为:页面缓存(中庸)、数据源缓存(最不灵活的)、数据缓存(灵活)这三种主要类型。①页面缓存:给页面添加<%@ OutputCache Duration=“15” VaryByParam=“none”%>标签就可以启用页面缓存,这样整个页面的内容都会被缓存,页面中的ASP.Net代码、数据源在缓存期间都不会被运行,而是直接输出缓存的页面内容。 也就是不会执行C#和HTML代码,直接到缓存空间中拿已经存在的页面。对于看新闻页面来讲,如果如上设置的话,则会缓存在第一个看到的新闻,因为?id=2、?id=3只是页面的不同参数而已,为了能让不同的新闻各自缓存,因此可以 阅读全文
posted @ 2012-04-19 18:32 朱文锋 阅读(1765) 评论(1) 推荐(1) 编辑
摘要:1 添加log4net dll的引用2 在web.config中添加如下代码①放在<configSections>节点下面1 <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>②放在<configSections/>下面 1 <log4net> 2 <!-- Define some output appenders --> 3 <appender name=& 阅读全文
posted @ 2012-04-18 17:10 朱文锋 阅读(1132) 评论(0) 推荐(0) 编辑
摘要:1 在GridView获取单元格的值①BoundField绑定的内容gvUsers.Rows[1].Cells[2].Text(非编辑状态)TextBox txtCount = (TextBox)gvUsers.Rows[e.RowIndex].Cells[2].Controls[0];(编辑状态)然后通过txtCount.Text属性得到值e.RowIndex是编辑行的索引②模板列 绑定的内容(推荐使用label控件)Convert.ToInt32(((Label)gvUsers.Rows[e.RowIndex].FindControl("lbId")).Text);(( 阅读全文
posted @ 2012-04-15 21:18 朱文锋 阅读(1551) 评论(0) 推荐(0) 编辑
摘要:一、写一个分页类using System;using System.Text;using System.Diagnostics;namespace Zhuwenfeng{ public class MyPager { /// <summary> /// 总数据条数 /// </summary> public int TotalCount { get; set; } /// <summary> /// 每页数据条数 /// </summary> public int PageSize { get; set; } /// <summary> 阅读全文
posted @ 2012-04-09 21:45 朱文锋 阅读(1037) 评论(1) 推荐(3) 编辑