62,266
社区成员
发帖
与我相关
我的任务
分享
this.AspNetPager1.PageSize=pagesize;
this.AspNetPager1.PageButtonCount=4;
this.AspNetPager1.RecordCount=allcount;
//GridView绑定
public void GridViewBind()
{
DataSet ds = new DataSet();
RawDataReviewMasterBLL myRawDate = new RawDataReviewMasterBLL();
ds = myRawDate.GetDateTableForRawData(Plant, Material, Amount, Pstg_DataFrom, Pstg_DataTo, AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex);
AspNetPager1.RecordCount = myRawDate.GetRecordCountForAspNetPager(Plant, Material, Amount, Pstg_DataFrom, Pstg_DataTo);
CPSGridView1.DataSource = ds.Tables[0];
CPSGridView1.DataBind();
ds.Clear();
}
//分页
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
GridViewBind();
}
string aa ="select c.*,a.uid,a.username,a.itemno,a.browseviews,b.avatar,b.chengni,b.sex,b.jifen,b.dengji,b.bobi,b.qianming,d.club_name,d.club_id";
aa+=" from bbs_users a inner join bbs_userfields b on a.uid=b.uid inner join e8e_Club_ActivityComment c on a.uid=c.commentator";
aa +=" inner join e8e_Club_Sys d on c.commentator=d.club_userid where c.huodongid='" + Request["huodongid"] + "' order by c.createtime desc ";
string photonum = "select count(commentid)as num from e8e_Club_ActivityComment where huodongid=" + Request["huodongid"];
SQLcon sl = new SQLcon();
SqlDataAdapter sda;
DataSet ds = new DataSet();
SqlCommand sqlcmd;
sda = new SqlDataAdapter(aa, sl.Connection);
sda.Fill(ds, AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "e8e_Club_ActivityComment");
sqlcmd = new SqlCommand(photonum, sl.Connection);
sl.ConOpen();
AspNetPager1.RecordCount = (int)sqlcmd.ExecuteScalar();
if (ds.Tables.Count > 0)
{
rpComments.DataSource = ds.Tables["e8e_Club_ActivityComment"]; rpComments.DataBind();
}
else { spError.InnerHtml = "<font <font style='font-size:xx-large;color:Red' >暂无心语评论</font>"; }
sl.ConClose();