日期:2014-05-18  浏览次数:20455 次

利用DataList控件做的翻页页面怎么利用ajax调用后翻页功能就无效了?
我做的翻页-class.aspx,下面是CS文件里的部分代码:

if(!Page.IsPostBack)
{
    CurrentPage=0;
    ViewState[ "CurrentPage "]=0;
    string   sk=SQL_Key;
    switch(sk)
    {
        case   "1 ":
sql_sum= "select   count(*)   as   co   from   products   where   ( "+Key+ ")   and   active=0 ";
sql_main= "select   *   from   products   where   ( "+Key+ ")   and   active=0   order   by   ID   DESC ";
break;

case   "2 ":
sql_sum= "select   count(*)   as   co   from   products   where   ( "+Key+ ")   and   grade=3   and   active=0 ";
sql_main= "select   *   from   products   where   ( "+Key+ ")   and   grade=3   and   active=0   order   by   ID   DESC ";
break;

case   "3 ":
sql_sum= "select   count(*)   as   co   from   products   where   ( "+Key+ ")   and   grade=2   and   active=0 ";
sql_main= "select   *   from   products   where   ( "+Key+ ")   and   grade=2   and   active=0   order   by   ID   DESC ";
break;

case   "4 ":
sql_sum= "select   count(*)   as   co   from   products   where   ( "+Key+ ")   and   grade=4   and   active=0 ";
sql_main= "select   *   from   products   where   ( "+Key+ ")   and   grade=4   and   active=0   order   by   ID   DESC ";
break;

default:
sql_sum= "select   count(*)   as   co   from   products   where   ( "+Key+ ")   and   active=0 ";
sql_main= "select   *   from   products   where   ( "+Key+ ")   and   active=0   order   by   ID   DESC ";
break;
    }
    //sql_sum= "select   count(*)   as   co   from   products   where   category   like   '% "+Cate_Key+ "% ' ";
    ViewState[ "sql_sum "]=sql_sum;
    RecordCount=jisuan(sql_sum);
    jilushu.Text=RecordCount.ToString();
    PageCount=(RecordCount-1-((RecordCount-1)%PageSize))/PageSize+1;
    zongyeshu.Text=PageCount.ToString();
    ViewState[ "PageCount "]=PageCount;
    //sql_main= "select   *   from   products   where   category   like   '% "+Cate_Key+ "% '   order   by   ID   DESC ";
    ViewState[ "sql_main "]=sql_main;
    BindList(sql_main);
}
    }
 
    public   int   jisuan(string   key_sum)
    {
        int   shu;
OleDbCommand   comm=new   OleDbCommand(key_sum,conn);
OleDbDataReader   rd=comm.ExecuteReader();
if(rd.Read())
{
    shu=Int32