js ajax分页的排版问题
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserGet.aspx.cs" Inherits="WzJyw.manager.UserGet" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www. >
<head runat="server">
<title>无标题页</title>
<%-- <link rel="stylesheet" type="text/css" href="skin/css/main.css"> --%>
<style type="text/css">
.style1
{
width: 15%;
}
.style2
{
width: 20%;
}
.style3
{
width: 5%;
}
.style4
{
width: 10%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">
<tr bgcolor="#E7E7E7">
<td height="24" colspan="5" background="skin/images/tbg.gif" align=center> 会员列表 </td>
</tr>
<tr bgcolor="#FAFAF1" height="22" align=center>
<td class="style1">用户名</td>
<td class="style1">密码</td>
<td class="style3">类型</td>
<td class="style1">注册时间</td>
<td class="style4">操作</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table width="98%" border="0" cellpadding="2" cellspacing="1" align="center">
<tr align="center" bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
<td class="style1"><a href="DetailsManager.aspx?userid=<%#DataCommon.Users.GetUserid(Eval("YongHu").ToString())%>"><%#Eval("YongHu")%></a></td>
<td class="style1"><%#Eval("Passwod")%></td>
<td class="style3"><%#DataCommon.Users.Gettype(int.Parse(Eval("Type").ToString()))%></td>
<td class="style1"><%#Eval("RegistDateTime")%></td>
<td class="style4">
<a href="UserManager.aspx?id=<%#Eval("Id")%>">修改</a>
<%-- <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="return confirm('您确定删除吗')" CommandArgument='<%#Eval("Id")%>' OnClick="LinkButton1_Click">删除</asp:LinkButton>--%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
</form>
</body>
</html>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DataCommon;
using System.Data.SqlClient;
using System.Text;
using Common;
namespace WzJyw.manager
{
public partial class UserGet : System.Web.UI.Page
{
string strConn = SqlHelper.ConnectionStringLocalTransaction;
string s_CurrentPage = string.Empty;
string s_PageCount = string.Empty;
string s_RecordCount = string.Empty;
int i_CurrentPage = 0;
int i_PageCount = 0;
int i_RecordCount = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Params["PageIndex"] != null)
{
if (!string.IsNullOrEmpty(Request.Params["PageIndex"]))
{
s_CurrentPage = Request.Params["PageIndex"].ToString();
i_CurrentPage = Int32.Parse(s_CurrentPage);
}
}
BindDateList();
}
void BindDateList()
{
string strSql_Count = "Select * from Users";
s_RecordCount = SqlHelper.ExecuteDataTable(CommandType.Text,strSql_Count).Rows.Count.ToString();
i_RecordCount = Convert.ToInt32(s_RecordCount);
if (i_RecordCount % 4 > 0)
{
i_PageCount = i_RecordCount / 4 + 1;
}
else
{
i_PageCount = i_RecordCount / 4;
}
s_PageCount = i_PageCount.ToString();
string strRecordTemp = string.Empty;
strRecordTemp = Convert.ToString(i_CurrentPage * 4);
string strSql = string.Empty;
if (s_CurrentPage == "0")
{
strSql = "select top 4 * from Users order by Id DESC";
}
else
{
strSql = "select top 4 * from Users where Id not in (select top " + strRecordTemp + " Id from Users order by ID DESC) order by Id DESC";
}
SqlDataReader Rdlist = SqlHelper.ExecuteReader(strConn, strSql, null);
DataTable Dt = new DataTable();
DataRow dr;
//F_Code,F_Name,F_Sex,F_Title,F_Email,F_feeling,F_facepic,F_From,F_Tel,F_Mobile,F_Replay,F_bHaveReplay,F_AddTime,F_ip,F_Book,F_show
Dt.Columns.Add("Id", typeof(int));//0
Dt.Columns.Add("YongHu", typeof(string));//1
Dt.Columns.Add("Passwod", typeof(string));//2
Dt.Columns.Add("PasswordTips", typeof(string));//3
Dt.Columns.Add("PasswordAnswer", typeof(string));//4
Dt.Columns.Add("Type", typeof(int));//5
Dt.Columns.Add("RegistDateTime", typeof(string));//6
while (Rdlist.Read())
{
dr = Dt.NewRow();
dr[0] =Convert.ToInt16(Rdlist[0]);
dr[1] = Rdlist[1].ToString();
dr[2]= Rdlist[2].ToString();
dr[3] = Rdlist[3].ToString();
dr[4] = Rdlist[4].ToString();
dr[5] =Convert.ToInt16(Rdlist[5]);
dr[6] = Rdlist[6].ToString();
Dt.Rows.Add(dr);
}
Rdlist.Close();
this.Repeater1.DataSource = new DataView(Dt);
this.Repeater1.DataBind();
}
protected override void Render(HtmlTextWriter writer)
{
if (i_RecordCount > 0)
{
StringBuilder sp = new StringBuilder();
sp.AppendLine("<div style=\"width:100%;font-size:12px;\">");
sp.Append(" 共 ");
sp.Append(s_RecordCount);
sp.Append(" 条记录");
sp.Append(" ");
if (i_PageCount > 1)
{
if (i_CurrentPage == 0)
{
sp.AppendLine("<a href=\"javascript:Paging(" + Convert.ToString(i_CurrentPage + 1) + ")\" style=\"text-decoration:none;height:17px;\">下一页</a>");
sp.AppendLine(" ");
sp.AppendLine("<a href=\"javascript:Paging(" + Convert.ToString(i_PageCount - 1) + ")\" style=\"text-decoration:none;height:17px;\">末页</a>");
sp.AppendLine(" ");
}
else
{
if (Convert.ToInt32(i_CurrentPage + 1) == i_PageCount)
{
sp.AppendLine("<a href=\"javascript:Paging(0)\" style=\"text-decoration:none;height:17px;\">首页</a>");
sp.AppendLine(" ");
sp.AppendLine("<a href=\"javascript:Paging(" + Convert.ToString(i_CurrentPage - 1) + ")\" style=\"text-decoration:none;height:17px;\">上一页</a>");
sp.AppendLine(" ");
}
else
{
sp.AppendLine("<a href=\"javascript:Paging(0)\" style=\"text-decoration:none;height:17px;\">首页</a>");
sp.AppendLine(" ");
sp.AppendLine("<a href=\"javascript:Paging(" + Convert.ToString(i_CurrentPage - 1) + ")\" style=\"text-decoration:none;height:17px;\">上一页</a>");
sp.AppendLine(" ");
sp.AppendLine("<a href=\"javascript:Paging(" + Convert.ToString(i_CurrentPage + 1) + ")\" style=\"text-decoration:none;height:17px;\">下一页</a>");
sp.AppendLine(" ");
sp.AppendLine("<a href=\"javascript:Paging(" + Convert.ToString(i_PageCount - 1) + ")\" style=\"text-decoration:none;height:17px;\">末页</a>");
sp.AppendLine(" ");
}
}
}
sp.AppendLine("<span >共" + s_PageCount + "页,当前第" + Convert.ToString(i_CurrentPage + 1) + "页</span>");
sp.AppendLine("</div>");
writer.Write(sp.ToString());
}
this.Repeater1.RenderControl(writer);
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
try
{
LinkButton lb = (LinkButton)sender;
int id = 0;
int.TryParse(, out id);
int i = Users.Delete(id);
if (i > 0)
{
UserMatter.Add(id, (int)UserMatter.MatterType.ShanChu, "删除用户" + Users.GetField(id, "YongHu"));
//UserMatter.Add(id, (int)UserMatter.MatterType.ShanChu, "删除用户详细信息" + Users.GetField(id, "YongHu")); //尚未实现删除用户的同时也删除用户详细信息
MBox.RefUrl(2);
}
else
{
Response.Redirect("Error.aspx");
}
}
catch
{
Response.Redirect("Error.aspx");
}
}
}
}
希望高手帮忙解决下