• 内存分页


    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.SqlClient;
    using System.Linq;
    using System.Net;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class userinfo : System.Web.UI.Page
    {
        public string UsersIp = Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault<IPAddress>(a => a.AddressFamily.ToString().Equals("InterNetwork")).ToString();
        public DateTime UsersTime = DateTime.Now;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }
    
        protected void Button1_Click(object sender, EventArgs e)
        {
            BindData();
        }
    
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindData();
        }
        private void BindData()
        {
            string sql = "select * from Users where 1 = 1 ";
            if (TextBox1.Text.Trim().Length > 0)
            {
                sql += "and UserName ='" + TextBox1.Text.Trim() + "'";
            }
            DataTable dt = SqlHelp.ExecuteDataTable(sql, null);//读取数据 内存数据表中
            AspNetPager1.RecordCount = dt.Rows.Count; //分页控件总记录数等于数据总记录数
    
            PagedDataSource psd = new PagedDataSource(); //数据绑定对象
            psd.DataSource = dt.DefaultView;//数据源=默认视图
            psd.AllowPaging = true;  //数据绑定启用
            psd.PageSize = AspNetPager1.PageSize;//要显示的数目
            psd.CurrentPageIndex = this.AspNetPager1.CurrentPageIndex - 1;//当前页的索引
    
            rep1.DataSource = psd; //绑定数据源
            rep1.DataBind();
        }
    }
  • 相关阅读:
    APK: 开机自启
    Android Button 三种监听方式
    unity 获取Project面板已选择资源的路径
    unity 自定义Project面板右键菜单
    unity Mathf.Atan2()
    unity/C# 通过反射调用对象的私有方法
    Unity WebGL 去除移动端的警告
    Unity Shader 序列帧动画
    Unity Shader 3种精度的数值类型
    Unity Shader Unity支持的语义
  • 原文地址:https://www.cnblogs.com/enych/p/7832883.html
Copyright © 2020-2023  润新知