ASP.NET中GridView分页
方法一:
新建一个页面然后在页面拖一个GridView控件在属性框中设置GridView控件的AllowPaing属性为True 然后再设置GridView的PageSize属性,源文件如下:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames ="classId" CellPadding="5" OnRowDeleting="GridView1_RowDeleting" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging" PageSize ="15">
<Columns>
<asp:BoundField DataField ="className" HeaderText ="名称" />
<asp:BoundField DataField="classDes" HeaderText="描述" SortExpression="classDes" />
</Columns>
<PagerTemplate>
<table style="font-size :12px;">
<tr>
<td> 总共<asp:Label ID="Label1" runat="server" Text="<%#((GridView)Container.NamingContainer).PageCount %>"></asp:Label>页 </td>
<td> 第<asp:Label ID="Label2" runat="server" Text="<%#((GridView)Container.NamingContainer).PageIndex+1 %>"></asp:Label>页 </td>
&n
相关文档:
asp.net中“线程正被中止”异常的解决方法
在项目里负责异常处理部分:异常信息的写入,读取,查看,因此就可以看到各种异常,受益匪浅
看到有N多的“线程正被中止”异常,而且来自同一个页面。
System.Threading.ThreadAbortException: 线程正被中止。
at System.Threading.Thread.AbortInternal( ......
方法1:
比如建立一个名为cnlive,值为"123"的cookie
HttpCookie cookie = new HttpCookie["cnlive"];
cookie.Value = "123";
Response.AppendCookie(cookie);
取刚才写入的Cookie值:
HttpCookie cookie = Request.Cookies["cnlive"];
cookieValue = cookie.Value;
在一个Cookie中储存多个信息:
HttpCookie cookie ......
配置文件可用来存放一些多次用到的常量数据,如连接串:
<appSettings>
<add key="connStr1" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="/>
<add key="connStr2" value="App_Data\test.mdb"/>
</appSettings>
这个配置数据库连接串
使用示例:
public class DBCo ......
缓存是把应用程序中的需要频繁、快速访问的数据保存在内存中的编程技术,通常用来提高网络的响应速度。在ASP.NET中使用Cache类来管理缓存。下面详述控件级数据缓存功能和页面级数据缓存功能的实现:
(1)数据库缓存依赖
数据库缓存依赖由SqlCacheDependency类管理;
数据库缓存依赖的优点:
1、提高数据呈现速度,每次获 ......