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( ......
配置文件可用来存放一些多次用到的常量数据,如连接串:
<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编程规范之命名规范都有哪些呢?具体又有什么内容呢?让我们开始吧:
ASP.NET编程规范之命名规范1.按钮ID命名:
btn+按钮操作功能(如btnSave)
ASP.NET编程规范之命名规范2.其它控件:
I.与数据操作相关:其ID<.SPAN>为相应的字段名称,如果有多个控件对应一个字段,则按以下规范命名:
字段名+&rdqu ......
客户端传送数据到服务器端有三种方法:
1.form
2.querystring
3.cookie
利用这些方式取得的数据在服务器端都是字典集合,如果要精确取到某个集合的值,则直接使用对应的集合的名称,三种方式对应的集合如下:
1.form:request.form
2.querystring:request.querystring
3.cookie:request.cookie
利用request.p ......