惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
MyScale Blog
MyScale Blog
博客园 - Franky
The Cloudflare Blog
IT之家
IT之家
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
The Blog of Author Tim Ferriss
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
Google DeepMind News
Google DeepMind News
P
Proofpoint News Feed
Martin Fowler
Martin Fowler
aimingoo的专栏
aimingoo的专栏
J
Java Code Geeks
腾讯CDC
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog
博客园 - 【当耐特】
美团技术团队
云风的 BLOG
云风的 BLOG

博客园 - maoyu417

Size Classes with Xcode 6 Android viewPage notifyDataSetChanged无刷新 android、apple PUSH 异同比较 同一位置(同一个ImageView)显示不同的图片--level-list (转) (Android实战)界面设计注意事项 LinearLayout android:layout_weight的理解 给C盘减减肥,让你电脑飞一般速度! 用SQL查看字符串ASCII码 解决union不能order by问题 利用sender的Parent获取GridView中的当前行(转载) gridview固定表头 - maoyu417 - 博客园 将某网站设为主页方法 - maoyu417 - 博客园 SQL区分大小写——转载 字符串间空格在网页上自动合并 Windows Mobil中解决日期显示不正常的方法 VS升级序列号及升级方法 a标签变灰且不可用 ASP.NET读取XML文件4种方法 超时时间已到。在操作完成之前超时时间已过或服务器未响应。
DataList分页方法一 - maoyu417 - 博客园
maoyu417 · 2008-02-19 · via 博客园 - maoyu417

SqlConnection conn = new SqlConnection();
            conn.Open();
            SqlDataAdapter da = new SqlDataAdapter(sql, conn);
            DataSet ds = new DataSet();
            da.Fill(ds, "Product_gongqiu");

            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = ds.Tables["Product_gongqiu"].DefaultView;
            //开启分页
            pds.AllowPaging = true;
            //显示显示的行数
            pds.PageSize = 8;
            //定义变量保存当前页索引
            int curPage;

            //判断当前页是否有跳转请求
            if (Request.QueryString["page"] != null)
                curPage = Convert.ToInt32(Request.QueryString["page"]);
            else
                curPage = 1;
            pds.CurrentPageIndex = curPage - 1;

            Label1.Text = "当前第" + curPage.ToString() + "页";
            Label2.Text = "共" + pds.PageCount.ToString() + "页";


            if (!pds.IsFirstPage)
            { //定义"上一页"超级连接的URL为:当前执行页面的虚拟路径,并传递下一页面的索引植
                prev.NavigateUrl = "@@@.aspx?page=" + (curPage - 1) + "&sqltext=" + sql + "&tiaojiantext=" + tiaojian;
            }
            if (!pds.IsLastPage)
            { //下一页
                next.NavigateUrl = "@@@.aspx?page=" + (curPage + 1) + "&sqltext=" + sql + "&tiaojiantext=" + tiaojian;
            }

            DataList1.DataSource = pds;
            DataList1.DataBind();