AspNetPager + GridView + ASP.NET AJAX 分頁無重新整理實現

來源:互聯網
上載者:User

在網上看到這篇文章《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事件 老是提示莫名奇怪的錯誤,或者乾脆沒有翻頁效果;

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.