public void getnew(int num)
{
string sql;
if(num==1)
{
sql = "userid=" + Convert.ToInt32(Session["uid"].ToString()) + " and isnew=1";
}
else if (num == 2)
{
sql = "userid=" + Convert.ToInt32(Session["uid"].ToString()) + " and ishot=1";
}
else if (num == 3)
{
sql = "userid=" + Convert.ToInt32(Session["uid"].ToString()) + " and isshelves=1";
}
else
{
sql = "userid=" + Convert.ToInt32(Session["uid"].ToString()) + " and isspecial=1";
}
PagedDataSource pds = new PagedDataSource();
pds.AllowPaging = true;
AspNetPager1.RecordCount = obj.GetList(sql).Tables[0].Rows.Count;
pds.PageSize = AspNetPager1.PageSize;
pds.DataSource = obj.GetList(sql).Tables[0].DefaultView;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
Repeater1.DataSource = pds;
Repeater1.DataBind();
}就是这个方法会得到四组数据,在分页控件中点击下一页,怎么判断绑定的是那组数据,就是在 protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
getnew(1);
getnew(2);
getnew(3);
getnew(4); }
这样写,点击下一页容易出现内容串联,在前台我这四组数据我用的是四个linkbutton控件,在分页事件中我如何判断我是那个linkbutton然后执行分页事件呢。
{
string sql;
if(num==1)
{
sql = "userid=" + Convert.ToInt32(Session["uid"].ToString()) + " and isnew=1";
}
else if (num == 2)
{
sql = "userid=" + Convert.ToInt32(Session["uid"].ToString()) + " and ishot=1";
}
else if (num == 3)
{
sql = "userid=" + Convert.ToInt32(Session["uid"].ToString()) + " and isshelves=1";
}
else
{
sql = "userid=" + Convert.ToInt32(Session["uid"].ToString()) + " and isspecial=1";
}
PagedDataSource pds = new PagedDataSource();
pds.AllowPaging = true;
AspNetPager1.RecordCount = obj.GetList(sql).Tables[0].Rows.Count;
pds.PageSize = AspNetPager1.PageSize;
pds.DataSource = obj.GetList(sql).Tables[0].DefaultView;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
Repeater1.DataSource = pds;
Repeater1.DataBind();
}就是这个方法会得到四组数据,在分页控件中点击下一页,怎么判断绑定的是那组数据,就是在 protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
getnew(1);
getnew(2);
getnew(3);
getnew(4); }
这样写,点击下一页容易出现内容串联,在前台我这四组数据我用的是四个linkbutton控件,在分页事件中我如何判断我是那个linkbutton然后执行分页事件呢。
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
int i=(int)viewSatet["num"];
getnew(i);
}