protected int getCount()
{
//設定總資料行.
int sum = lqc.Photo_Category.Count();
labPageCount.Text = sum.ToString();
//擷取可以分的頁面
int s1 = sum / pageSize;
//當總行數對頁數求餘後是否大于0,如果大于擷取1否則擷取0
int s2 = sum % pageSize > 0 ? 1 : 0;
//計算出總頁數
int count = s1 + s2;
return count;
}
protected void lnkbtnUp_Click(object sender, EventArgs e)
{
//設定目前頁數為目前頁數減一
ViewState["pageIndex"] = Convert.ToInt32(ViewState["pageIndex"]) - 1;
//調用自定義bindGrid方法綁定GridView控件
BindGV();
}
protected void lnkbtnDown_Click(object sender, EventArgs e)
{
//設定目前頁數為目前頁數加一
ViewState["pageIndex"] = Convert.ToInt32(ViewState["pageIndex"]) + 1;
//調用自定義bindGrid方法綁定GridView控件
BindGV();
}
protected void lnkbtnBottom_Click(object sender, EventArgs e)
{
//設定目前頁數為總頁面減一
ViewState["pageIndex"] = getCount() - 1;
//調用自定義bindGrid方法綁定GridView控件
BindGV();
}