Ajax does not refresh paging simple implementation _ajax related

Source: Internet
Author: User

This example for you to share the Ajax no refresh pagination of the specific code for your reference, the specific contents are as follows

HTML page

 

webservice1.asmx

Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using System.Web.Services;


Using System.Data; Namespace Page {///<summary>///WebService1 Summary description///</summary> [WebService (Namespace = "Http://temp uri.org/")] [webservicebinding (ConformsTo = wsiprofiles.basicprofile1_1)] [System.ComponentModel.ToolboxItem (False
  )]//To allow the use of ASP.net AJAX to invoke this Web service from a script, uncomment the downlink. [System.Web.Script.Services.ScriptService] public class WebService1:System.Web.Services.WebService {[Webmetho
    D] public string HelloWorld () {return ' Hello world '; [WebMethod] public list<model.t_news1> getlistajax (int pagesize,int pageindex) {BLL. T_news1 bnews = new BLL.
      T_NEWS1 (); DataTable dt = bnews.
      Getlistdatatable (Pagesize,pageindex);
      list<model.t_news1> list = new list<model.t_news1> ();
      int Id;
      String newstitle = "";
      String newscontent = ""; DateTime CreaTetime; for (int i = 0; i < dt. Rows.Count; i++) {Id = Convert.ToInt32 (dt.
        rows[i]["Id"]); Newstitle = dt. rows[i]["Newstitle"].
        ToString (); newscontent = dt. rows[i]["Newscontent"].
        ToString (); Createtime = convert.todatetime (dt.
        rows[i]["Createtime"]); MODEL.T_NEWS1 news = new Model.t_news1 () {id = id, newstitle = newstitle, Newscon
        Tent = newscontent, createtime = Createtime}; List.
      ADD (news);
        
    } return list; [WebMethod] public int getlastpageindex (int pagesize) {BLL. T_news1 bnews = new BLL.
      T_NEWS1 (); int totalcount = Bnews.
      GetRecordCount ("");
      if (totalcount% pagesize = = 0) {return totalcount/pagesize;
      else {return totalcount/pagesize + 1;

 }
    }


  }
}

Above is the Ajax no refresh paging implementation of the key code, I hope to help you learn.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.