ÓÃAspNetPagerºÍViewState·Ö±ðʵÏÖasp.net·ÖÒ³
ÒÔϽéÉÜÁ½ÖÖ·ÖÒ³£¬ÓÃAspNetPagerºÍViewState
Ò».AspNetPagerµÄÓ÷¨
1. ¸´ÖÆAspNetPager.dllµ½binĿ¼£¬ÔÚ¹¤¾ßÏä->Ñ¡ÔñÏî->ä¯ÀÀ£¬Ìí¼ÓbinϵÄÒýÓá£
2. ´Ó¹¤¾ßÏäÍϸöAspNetPager£¬¸ÄÈçÏÂÊôÐÔ£º
PageSize--ÿҳÏÔʾµÄ¼Ç¼Êý
CustomInfoHTML--×Ô¶¨ÒåÏÔʾÎı¾£¬Ò»°ãΪ“µÚ%CurrentPageIndex%Ò³ ¹²%PageCount%Ò³”
ShowCustomInfoSection--ÏÔʾµ±Ç°Ò³ºÍ×ÜÒ³ÊýÐÅÏ¢£¬ÖµÎªNever£¬Right£¬Left
AlwaysShow--×ÜÊÇÏÔʾ·ÖÒ³¿Ø¼þ
PageIndexBoxType--Ö¸¶¨Ò³Ë÷Òý¿òµÄÏÔʾÀàÐÍ£¬ÖµÎªÎı¾¿ò£¬ÏÂÀÁбí¿ò
ShowPageIndexBox--Ö¸¶¨Ò³Ë÷Òý¿òµÄÏÔʾ·½Ê½£¬ÖµÎªAlways£¬Never£¬Auto
TextAfterPageIndexBox--Ò³Ë÷Òý¿òºóµÄÎı¾ÄÚÈÝ£¬Ò»°ãΪ“Ò³”
TextBeforePageIndexBox--Ò³Ë÷Òý¿òǰµÄÎı¾ÄÚÈÝ£¬Ò»°ãΪ“תµ½”
ÏÔʾÈçÏÂ
3. ÔÚAspNetPagerµÄPageChangedʼþÖÐдÈçÏ´úÂ룺
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
Databind();
}
private void Databind()
{
PagedDataSource pds = new PagedDataSource();
pds.DataSource = List<T>;
pds.AllowPaging = true;
pds.PageSize = AspNetPager1.PageSize; //AspNetPager1ÊÇID
AspNetPager1.RecordCount = pds.DataSourceCount;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
GridView1.DataSource = pds; //°ó¶¨µ½GridView
GridView1.DataBind();
}
¶þ. ViewState
1.Ëĸö°´Å¥´¥·¢ÒÔÏÂ
Ïà¹ØÎĵµ£º
½ñÌìÑо¿ÁËÒ»ÏÂÔÚasp.netÏÂÓÃC#ÓïÑÔѹËõÎļþ£¬ºÍ½âѹÎļþ£¬ÔÚÍøÉϺÃÁ˺þòÅÕÒµ½Ô´´úÂ룬£¬Õæ²»ÈÝÒ×°¡£¡£¡
ÔÚ ASP.NET ÖÐÓÐÁ½¸öÀࣺDeflateStream ºÍ GZipStream ÓÃÓÚ´¦ÀíѹËõºÍ½âѹËõ£¬ÕâÁ½¸öÀà·Ö±ðʹÓõÄÊÇ DEFLATE ºÍ gzip ѹËõËã·¨£¬ÕâÁ½¸öËã·¨±»Ò»Ð©Ñ¹ËõÈí¼þÖ§³Ö£¬±ÈÈç WinRAR ¾ÍÖ§³Ö gzip¡£ÕâÁ½¸öÀàµÄÃû³Æ¿Õ¼ä¾ùΪ£ ......
(Ò»).Ñ¡Ôñ»á»°×´Ì¬´æ´¢·½Ê½
ÔÚWebconfigÎļþÅäÖÃ:
<sessionState mode="???" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=y ......
1.
ClientScript.RegisterStartupScript(this.GetType(), "js1", "alert('ɾ³ý³É¹¦');window.location='QuerySortList.aspx';", true);
2.
this.cmdSave.Attributes.Add("onclick", "return f_StringCheck()"); ......
/// <summary>
/// Ìṩ¾³£ÐèҪʹÓõÄһЩÑéÖ¤Âß¼¡£ ±ÈÈç ÓÊÏäÊÇ·ñºÏ·¨
/// </summary>
public class Validator
{
/// <summary>
&nbs ......
ÕâÀïÎÒֻժȡÁËÔÎĵÄCodeÒÔ¹©Ç±ÐÄÑо¿.using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Data.SqlClient;
using System.Web.Security;
using System.Data;
public ......