///
在加格達(dá)奇等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè) 網(wǎng)站設(shè)計(jì)制作定制網(wǎng)站開(kāi)發(fā),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),成都全網(wǎng)營(yíng)銷,外貿(mào)網(wǎng)站建設(shè),加格達(dá)奇網(wǎng)站建設(shè)費(fèi)用合理。
/// 分頁(yè)內(nèi)容
///
/// 頁(yè)面大小
/// 頁(yè)面數(shù)量
/// 當(dāng)前頁(yè)
/// url模式:demo.aspx?page={0}
/// 窗口模式 codego.net代碼
///
public static string get_pagenation(int size,
int count,
int currendIndex,
string pattern,
string target)
{
//1>打開(kāi)窗口目標(biāo)
target = string.IsNullOrEmpty(target) ? "_top" : target;
//2>總頁(yè)數(shù)
int pageCount = count / size;
pageCount = pageCount * size == count ? pageCount : pageCount + 1;
//3>分頁(yè)內(nèi)容
StringBuilder strHtml = new StringBuilder();
strHtml.Append("");
#region 首部處理
if (currendIndex > 1)
{
strHtml.AppendFormat("[首頁(yè)]", target);
strHtml.AppendFormat("[上一頁(yè)]", string.Format(pattern, currendIndex - 1), target);
}
else
{
strHtml.Append("[首頁(yè)] [上一頁(yè)]");
}
#endregion
#region 中間部分
int i = 1;
int right = (currendIndex + 4) > pageCount ? pageCount : currendIndex + 4;
if (currendIndex > 6)
{
i = currendIndex - 5;
}
else
{
right = pageCount >= 10 ? 10 : pageCount;
}
for (; i <= right; i++)
{
if (i == currendIndex)
{
strHtml.AppendFormat("{0}", i);
strHtml.AppendLine();
continue;
}
strHtml.AppendFormat("[{2}]", string.Format(pattern, i), target, i);
strHtml.AppendLine();
}
#endregion
#region 尾部處理
if (currendIndex == pageCount)
{
strHtml.Append("[下一頁(yè)][末頁(yè)]");
strHtml.AppendFormat("總共({0})頁(yè)", pageCount);
}
else
{
strHtml.AppendFormat("[下一頁(yè)]", string.Format(pattern, currendIndex + 1), target);
strHtml.AppendFormat("[末頁(yè)]", string.Format(pattern, pageCount), target);
strHtml.AppendFormat(" ", pageCount);
}
#endregion
strHtml.Append("");
return strHtml.ToString();
}