⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.aspx.cs

📁 aspnet请认真阅读您的文件包然后写出其具体功能(至少要20个字)。
💻 CS
字号:
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using Wuqi.Webdiyer;

public partial class CurrentPageIndex_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //cache the number of total records to improve performance
            object obj = Cache[GetType() + "totalOrders"];
            if (obj == null)
            {
                int totalOrders = (int) SqlHelper.ExecuteScalar(CommandType.StoredProcedure, "P_GetOrderNumber");
                Cache[GetType() + "totalOrders"] = totalOrders;
                obj = totalOrders;
            }
            AspNetPager1.RecordCount = (int) obj;
            bindData();
        }
    }

    void bindData()
    {
        GridView1.DataSource = SqlHelper.ExecuteReader(CommandType.StoredProcedure, ConfigurationManager.AppSettings["pagedSPName"],
            new SqlParameter("@startIndex", AspNetPager1.StartRecordIndex),
            new SqlParameter("@endIndex", AspNetPager1.EndRecordIndex));
        GridView1.DataBind();
        AspNetPager1.CustomInfoHTML = "Page  <font color=\"red\"><b>" + AspNetPager1.CurrentPageIndex + "</b></font> of  " + AspNetPager1.PageCount;
        AspNetPager1.CustomInfoHTML += "&nbsp;&nbsp;Orders " + AspNetPager1.StartRecordIndex + "-" + AspNetPager1.EndRecordIndex;
    }

    protected void AspNetPager1_PageChanged(object src, EventArgs e)
    {
        bindData();
        Response.Write("CurrentPageIndex:"+AspNetPager1.CurrentPageIndex+"<br/>");
    }
    protected void Button1_Click(object src,EventArgs e)
    {
        try
        {
            int pageindex = int.Parse(tb_pageindex.Text);
            AspNetPager1.CurrentPageIndex = pageindex;
        }
        catch(FormatException)
        {
            lbl_error.Text = "输入的页索引格式不正确";
        }
    }

    protected void AspNetPager1_PageChanging(object src, PageChangingEventArgs e)
    {
        Response.Write("NewPageIndex:" + e.NewPageIndex + "<br/>");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -