📄 pageset.ascx.cs
字号:
namespace jpgSoftware_SM.webControls
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
/// <summary>
/// pageSet 的摘要说明。
/// </summary>
public class pageSet : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.Label currentNum;
protected System.Web.UI.WebControls.Label recordNum;
protected System.Web.UI.WebControls.HyperLink first;
protected System.Web.UI.WebControls.HyperLink pre;
protected System.Web.UI.WebControls.HyperLink next;
protected System.Web.UI.WebControls.HyperLink last;
protected System.Web.UI.WebControls.Label totalPage;
pageSetClass pageclass = new pageSetClass();
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
// try
// {
//
// string pageIndex = Request.QueryString["PageNum"].Trim();
// string pageSize = Request.QueryString["PageSize"].Trim();
// int totalRecord = pageclass.TotalReocrd(sqlStr,whereStr);
// this.recordNum.Text = totalRecord.ToString();
// int m = totalRecord/Convert.ToInt32(pageSize);
// int n = totalRecord%Convert.ToInt32(pageSize);
// if(pageIndex=="1")
// {
// this.first.NavigateUrl = "?PageSize="+pageSize+"&PageNum=1";
// this.pre.NavigateUrl = "?PageSize="+pageSize+"&PageNum=1";
// if(m>0 && n>0)
// {
// int totalP = m+1;
// this.next.NavigateUrl = "?PageSize="+pageSize+"&PageNum=2";
// this.last.NavigateUrl = "?PageSize="+pageSize+"&PageNum="+totalP.ToString();
// this.totalPage.Text = totalP.ToString();
// }
// if(m>0 && n==0)
// {
// if(m==1)
// {
// this.next.NavigateUrl = "?PageSize="+pageSize+"&PageNum=1";
// this.last.NavigateUrl = "?PageSize="+pageSize+"&PageNum=1";
// this.totalPage.Text = "1";
// }
// else
// {
// int totalP = m+1;
// this.next.NavigateUrl = "?PageSize="+pageSize+"&PageNum=2";
// this.last.NavigateUrl = "?PageSize="+pageSize+"&PageNum="+totalP.ToString();
// this.totalPage.Text = totalP.ToString();
// }
// this.last.NavigateUrl = "?PageSize="+pageSize+"&PageNum="+(m+1);
// }
// }
// else
// {
// this.first.NavigateUrl = "?PageSize="+pageSize+"&PageNum=1";
// this.pre.NavigateUrl = "?PageSize="+pageSize+"&PageNum="+(Convert.ToInt32(pageIndex)-1);
// if(m>0 && n>0)
// {
// int totalP = m+1;
// this.next.NavigateUrl = "?PageSize="+pageSize+"&PageNum="+(Convert.ToInt32(pageIndex)+1);
// this.last.NavigateUrl = "?PageSize="+pageSize+"&PageNum="+totalP.ToString();
// this.totalPage.Text = totalP.ToString();
// }
// if(m>0 && n==0)
// {
// if(Convert.ToInt32(pageIndex)<m)
// {
// this.next.NavigateUrl = "?PageSize="+pageSize+"&PageNum="+(Convert.ToInt32(pageIndex)+1);
// }
// else
// {
// this.next.NavigateUrl = "?PageSize="+pageSize+"&PageNum="+m;
//
// }
// this.last.NavigateUrl = "?PageSize="+pageSize+"&PageNum="+m;
// this.totalPage.Text = m.ToString();
// }
// }
// }
// catch(Exception ex)
// {
// int totalRecord = pageclass.TotalReocrd(sqlStr,whereStr);
// this.recordNum.Text = totalRecord.ToString();
// int m = totalRecord/pageSize;
// int n = totalRecord%pageSize;
// this.currentNum.Text = "1";
// }
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -