62,046
社区成员
发帖
与我相关
我的任务
分享
protected void Page_Load(object sender, EventArgs e)
{
this.BindCI();
if (!Page.IsPostBack)
{
this.BindData(this.Pager1.CurrentPageIndex, this.Pager1.PageSize);
}
else
{
this.Pager1.OnPageIndexChanged = new PageIndexChangedDelegate(BindData);
}
}
public void BindCI()
{
this.Repeater_ci.DataSource = CompetitionPlatformBLL.T_BUS_CompetitionInformationBLL.GetList(" 1=1 order by C_Co_year desc");
this.Repeater_ci.DataBind();
}
protected void BindData(int PageIndex, int PageSize)
{
string fid = "";
if (HiddenField_selected_id.Value == "" || HiddenField_selected_id.Value == null)
{
fid = CompetitionPlatformBLL.T_BUS_CompetitionInformationBLL.GetTopModel().P_Co_id.ToString();
}
else
{
fid = this.HiddenField_selected_id.Value;
}
this.Pager1.RecordCount = CompetitionPlatformBLL.T_BUS_ComptitionNoticesBLL.GetList(" F_Co_id='" + fid + "' order by C_Co_isTop desc,C_Cn_addTime desc").Tables[0].Rows.Count;
if (this.Pager1.RecordCount > 0)
{
this.Label1.Visible = false;
this.Label1.Text = "";
this.Pager1.Visible = true;
int max = 0;
if (this.Pager1.RecordCount % PageSize == 0)
{
max = this.Pager1.RecordCount / PageSize;
}
else
{
max = (this.Pager1.RecordCount / PageSize) + 1;
}
if (PageIndex > max)
{
PageIndex = max;
}
this.Label2.Text = "页码是:" + this.Pager1.CurrentPageIndex;
DataTable dt = CompetitionPlatformBLL.T_BUS_ComptitionNoticesBLL.GetPage(PageSize, PageIndex, fid);
this.Repeater_cn.DataSource = dt;
this.Repeater_cn.DataBind();
}
else
{
this.Label1.Visible = true;
this.Label1.Text = "暂无数据";
this.Pager1.Visible = false;
this.Repeater_cn.DataSource = null;
this.Repeater_cn.DataBind();
}
}