zoukankan      html  css  js  c++  java
  • AspNetPager + GridView + ASP.NET AJAX 分页无刷新实现

    在网上看到这篇文章《AspNetPager + GridView + ASP.NET AJAX 分页无刷新实现 》 感觉收获很大, 这里推荐给大家,

    public partial class HYZXLIST : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetData();
            }
        }
      
        private void GetData()
        {
            Info i = new Info();
            int classid = 1;
            if (!string.IsNullOrEmpty(Request.QueryString["classid"]))
            {
                classid = int.Parse(Request.QueryString["classid"].ToString());
            }
    
            int pageindex = 1;
            //if (Request["page"] != null)
            //{
            //    pageindex = Convert.ToInt32(Request["page"]);
            //}
            if (AspNetPager1.CurrentPageIndex < 1)
            {
                pageindex = 1;
            }
            else
            {
                pageindex = AspNetPager1.CurrentPageIndex;
            }
            int pagenum = AspNetPager1.PageSize;
            int recordcount;
            string classname;
    
            ListView1.DataSource = i.GetInfoByClassID(pageindex, pagenum, out recordcount, classid, out classname);
            ListView1.DataBind();
            titleleft.InnerText = classname;
            titleright.InnerHtml = "你现在的位置>>" + classname;
            AspNetPager1.RecordCount = recordcount;
        }
        protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
        {
            AspNetPager1.CurrentPageIndex = e.NewPageIndex;
            GetData();
        }
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
    
        }
    }
    

    可以看到这里用的是page_changing事件;

    刚开始使用的pagechanged事件 老是提示莫名奇怪的错误,或者干脆没有翻页效果;

  • 相关阅读:
    网站服务化
    网站服务化
    dubbo 服务化
    dubbo 服务化
    elk 搭建
    poj1840
    poj1840
    poj2299
    poj2299
    poj2388
  • 原文地址:https://www.cnblogs.com/LittleFeiHu/p/2011242.html
Copyright © 2011-2022 走看看