public string NoHTML(string Htmlstring) //去除HTML標記
{
//刪除腳本
Htmlstring = Regex
//刪除HTML
Htmlstring = Regex
Htmlstring = Regex
Htmlstring = Regex
Htmlstring = Regex
Htmlstring = Regex
Htmlstring = Regex
Htmlstring = Regex
Htmlstring = Regex
Htmlstring = Regex
Htmlstring = Regex
Htmlstring = Regex
Htmlstring = Regex
Htmlstring = Regex
Htmlstring = Regex
Htmlstring
Htmlstring
Htmlstring
Htmlstring = HttpContext
return Htmlstring;
}
public string OutputBySize(string p_strContent)//分頁函數
{
string m_strRet =
int m_intPageSize =
int m_intCurrentPage =
int m_intTotalPage =
int m_intArticlelength = NoHTML(p_strContent)
if (m_intPageSize < m_intArticlelength)
{//如果每頁大小大於文章長度時就不用分頁了
if (m_intArticlelength % m_intPageSize ==
{//set total pages count
m_intTotalPage = m_intArticlelength / m_intPageSize;
}
else
{//if the totalsize
m_intTotalPage = m_intArticlelength / m_intPageSize +
}
if (Request
{//set Current page number
try
{//處理不正常的地址欄的值
m_intCurrentPage = Convert
if (m_intCurrentPage > m_intTotalPage)
m_intCurrentPage = m_intTotalPage;
}
catch
{
m_intCurrentPage = m_intCurrentPage;
}
}
//set the page content 設置獲取當前頁的大小
if (m_intCurrentPage < m_intTotalPage)
{
m_intPageSize = m_intCurrentPage < m_intTotalPage ? m_intPageSize : (m_intArticlelength
m_strRet += p_strContent
}
else if(m_intCurrentPage == m_intTotalPage )
{
int mm_intPageSize=m_intArticlelength
m_strRet += p_strContent
}
string m_strPageInfo =
for (int i =
{
if (i == m_intCurrentPage)
m_strPageInfo +=
else
m_strPageInfo +=
}
//輸出顯示各個頁碼
this
}
else
{
m_strRet += p_strContent;
}
return m_strRet;
}
protected void Page_Load(object sender
{
SqlDataReader dr = shuju
if (dr == null) return;
if (dr
{
this
前台頁面分頁處使用的控件
From:http://tw.wingwit.com/Article/program/net/201311/12101.html