• dropdownlist分页


    <div class="new-paging" id="">
                <div class="new-tbl-type">
                    <div class="new-tbl-cell">
                        <a href="<%=prevurl %>" class="new-a-prve"><span>上一页</span></a>
                    </div>
                    <div class="new-tbl-cell new-p-re" id="pagelist">
                        <div class="new-a-page">
                            <span class="new-open">1/100</span>
                        </div>
                        <asp:DropDownList ID="pageselect" runat="server" class="new-select" onchange="combocg(this);">
                        </asp:DropDownList>
                    </div>
                    <div class="new-tbl-cell">
                        <a href="<%=nexturl %>" class="new-a-next"><span>下一页</span></a>
                    </div>
                </div>
            </div>
     List<student"> list = null;
               	 List<student"> listst = null;
     		 SqlParameter[] parames = new SqlParameter[0]; 
    		string selsql="select * from student";
         		DataSet ds = SqlHelper.ExecuteDataSet(SqlHelper.SqlConncectionString, CommandType.Text, selSql, parames);
    		if (ds != null && ds.Tables[0].Rows.Count > 0)  
            	{  
               		rowsCount = ds.Tables[0].Rows.Count;
           		 }    
                    if ((nowPage - 1) * pageSize > rowsCount) nowPage = 1;
                    int takecount = rowsCount - (nowPage - 1) * pageSize;
                    if (takecount > pageSize)
                        listst = list.Skip((nowPage - 1) * pageSize).Take(pageSize).ToList();
                    else
                        listst = list.Skip((nowPage - 1) * pageSize).Take(takecount).ToList();
                    foreach (var img in listst)
                    {
                        img.C_IMGURL = img.C_IMGURL.Replace(".", "_130_140.");
                    }
                    pageselect.Items.Clear();
                    int pagecount = rowsCount % pageSize > 0 ? rowsCount / pageSize + 1 : rowsCount / pageSize;
                    for (int i = 0; i < pagecount; i++)
                    {
                        pageselect.Items.Add(new ListItem("第" + (i + 1).ToString() + "页", (i + 1).ToString()));
                    }
                    rplist.DataSource = listst;
                    rplist.DataBind();//绑定Repeater
                    url = "/Web/Manage/fenye.aspx?";
                    url += "&page=";
                    prevurl = nowPage > 1 ? url + (nowPage - 1) : url + "1";
                    nexturl = nowPage < pagecount ? url + (nowPage + 1) : url + nowPage;
                    pageselect.SelectedValue = nowPage.ToString();
    
  • 相关阅读:
    前端面试题—Js
    前端面试题—css
    前端面试题—html
    JavaScript 闭包
    JavaScript 计算斐波那切数列
    JavaScript continue使用
    JavaScript break 使用
    JavaScript 综合运算 (数字运算符+比较运算符+逻辑运算符)
    JavaScript 逻辑运算符 特殊字符 纯数字字符串
    JavaScript 比较运算符 特殊字符 纯数字字符串
  • 原文地址:https://www.cnblogs.com/dandanwozhishidan/p/3755607.html
Copyright © 2020-2023  润新知