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
相关文档:
Data Source=sqlservername;Initial Catalog=dbname;User ID=userid;Password=userpwd
Data Source=(local)\\SQLEXPRESS;Initial Catalog=数据库名;Integrated Security=True
Data Source=(local);Initial Catalog=数据库名;User ID=帐号;Password=帐号密码
Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\BegASPNET\ ......
1 response.redirect 这个跳转页面的方法跳转的速度不快,因为它要走2个来回(2次postback),但他可以跳 转到任何页面,没有站点页面限制(即可以由雅虎跳到新浪),同时不能跳过登录保护。但速度慢是其最大缺陷!redirect跳转机制:首先是发送一个http请求到客户端,通知需要跳转到新页面,然后客户端在发送跳转 ......
方法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 ......
影响ASP.Net应用性能的配置
1、删除不必要的HttpModule,每增加一个HttpModule,每个请求处理就多一点开销。
如:
<httpModules>
& ......
1.弹出对话框.
a. 弹出对话框:
C# codeClientScript.RegisterStartupScript(this.GetType(), "",
"<script>window.alert('该会员没有提交申请,请重新提交!')</script>");
b.转向指定页面
C# code Response.Write("
<script>window.location='http://www. ......