public void Bindlist()
{
BLL.Citybess BESS = new Citybess();
DataTable DT = BESS.getCitylist();
//this.Repeater1.DataSource = DT;
//this.Repeater1.DataBind();
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = DT.DefaultView;//ds.Tables[0].DefaultView;
objPds.AllowPaging = true;
objPds.PageSize = 10;
int CurPage;
if (Request.QueryString["Page"] != null)
CurPage = Convert.ToInt32(Request.QueryString["Page"]);
else
CurPage = 1;
objPds.CurrentPageIndex = CurPage - 1;
lblCurrentPage.Text = "当前页:" + CurPage.ToString();
int yeshu=objPds .PageCount;
//首页
this.link_shou.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1";
if (!objPds.IsFirstPage)
lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
if (!objPds.IsLastPage)
lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
//末页
this.link_mo.NavigateUrl = Request.CurrentExecutionFilePath + "?Page="+yeshu+"";
Repeater1.DataSource = objPds;
Repeater1.DataBind();
}
<%@ Page Title="关于我们" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" Debug="true"
CodeBehind="List.aspx.cs" Inherits="test.About" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta name="GENERATOR" content="Microsoft FrontPage 6.0" /><meta name="ProgId" content="FrontPage.Editor.Document" /><meta
http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>
</title><link href="styles/general.css" rel="stylesheet" type="text/css" /><link href="styles/main.css" rel="stylesheet"
type="text/css" />
<script type="text/javascript" src="js/vcom.js"></script>
<style type="text/css">
.pager
{
margin:10px auto 0px auto;
}
.pager td
{
font-size: 12px;
padding: 2px;
}
.pager td a
{
border:solid 1px #578ece;
padding:1px 5px 1px 5px;
}
#aspPage_input
{
margin-bottom:2px;
}
.style1
{
width: 158px;
}
.style2
{
width: 72px;
}
</style>
<script src="js/jquery-1.4.4.js" type="text/javascript"></script>
</head>
<body>
<div>
</div> <h1>
<span class="action-span"><a href="Shop_A_City.aspx">添加城市</a></span> <span class="action-span1">
<a href="Shop_Index_Main.aspx">管理中心</a> </span><span id="search_id" class="action-span1">
- 城市列表 </span>
<div style="clear: both">
</div>
</h1>
<script type="text/javascript" src="js/fucties.js"></script>
<script type="text/javascript" src="js/listtb.js"></script>
<div class="form-div">
城市名称关键词:<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="搜索" onclick="Button1_Click" />
<a href="insert.aspx"> 添加</a>
<%-- <asp:Button ID="Button2" runat="server" Text="添加" onclick="Button2_Click" />--%>
</div>
<div>
<table style="height: 151px; width: 633px">
<tr><td class="style2">自动编号</td><td>城市编号</td> <td>城市名称</td> <td>父节点</td> <td class="style1">修改</td> <td
class="style1">删除</td>
</tr>
<asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand">
<ItemTemplate>
<tr>
<td> <asp:CheckBox runat="server" ID="id" Text= '<%# Eval("id") %>'/></td>
<td> <asp:Label ID="Label1" runat="server" Text= '<%# Eval("Cityid") %>'/> </td>
<td><asp:Label ID="Label2" runat="server" Text= '<%# Eval("City") %>'/> </td>
<td><asp:Label ID="Label3" runat="server" Text= '<%# Eval("father") %>'/> <td>
<td> <a href='updateCity.aspx?ID=<%# Eval("ID")%>'> 修改</a> <td>
<td><asp:LinkButton ID="lbtnDelete" runat="server"
CommandName ="delete" style="position: relative" CommandArgument='<%
#DataBinder.Eval(Container.DataItem,"id")%>' >删除</asp:LinkButton>
<td>
</TR>
</ItemTemplate>
</asp:Repeater>
<tr>
<td > 当前页:<asp:Label ID="lblCurrentPage" runat="server" Text="Label"></asp:Label> </td>
<td> <asp:HyperLink ID="link_shou" runat="server">首页</asp:HyperLink> </td>
<td> <asp:HyperLink ID="lnkPrev" runat="server">上页</asp:HyperLink> </td>
<td> <asp:HyperLink ID="lnkNext" runat="server">下页</asp:HyperLink> </td>
<td> <asp:HyperLink ID="link_mo" runat="server">尾页</asp:HyperLink> </td>
</tr>
</table>
</div>
</asp:Content>