protected void Page_Load(object sender, EventArgs e)
{
string str = " It happened in 5 month 14 On Tuesday night 23 : 30 Langfang normal college 1 There was a vicious fight in the dormitory of the building 1 Building number is more complex, with students of sports, college of English, college of education and other students accommodation, at that time the situation is more chaotic. The victim is 1 The name 10 Grade ii physical education students (who are about to graduate) and 1 The name 11 The new students of grade I college of education are born on both sides The cause of the conflict is unknown at present, resulting on the spot 2 die 1 The wound is fatal. Among them 1 The person was cut throat artery by the murderer, without rescue, died on the spot; 1 He was stabbed in the kidney and died on the spot. 1 The man was stabbed in the heart as the ambulance arrived 1 Some of the rescue treatment, has been sent to the local hospital, its current well-being is unknown. The incident continued into the early hours of the morning 3 Points, in police The students dispersed under the lockdown. After the first 2 On the day of school students held no less than large and small 210 At the meeting, a large number of students were asked to block the news and not publicize it to the outside world. At present, the attitude of the school authorities was not clear. The family of the deceased repeatedly contacted the school authorities to ask for information, but they were blocked in the gate of the campus without meeting the school leaders or getting caught 1 A claim. in 2012 years 5 month 20 Day, the school on which 1 The names of the victims' families were given 1 Just say how much you want. The school did not consider the pain of the family members of the deceased, and the white people sent the black people. Due to its poor management, the school did not stop the fight, resulting in the two deaths of the students 1 Serious injury. Today, the bereaved family would like to invite friends from the media and netizens to pay attention and assist the bereaved family 1 Fair enough, dead man 1 A saying, for nothing but the rest of the dead. ";
Label1.Text = OutputBySize(str);
}
public string OutputBySize(string p_strContent)// The paging function
{
string m_strRet = "";
int m_intPageSize = 200;// Article size per page
int m_intCurrentPage = 1;// Set up the first 1 Page is the initial page
int m_intTotalPage = 0;
int m_intArticlelength = p_strContent.Length;// The article length
if (m_intPageSize < m_intArticlelength)
{// If the page size is larger than the article length, you do not need to paginate
if (m_intArticlelength % m_intPageSize == 0)
{//set total pages count
m_intTotalPage = m_intArticlelength / m_intPageSize;
}
else
{//if the totalsize
m_intTotalPage = m_intArticlelength / m_intPageSize + 1;
}
if (Request.QueryString["ps"] != null)
{//set Current page number
try
{// Handles abnormal address bar values
m_intCurrentPage = Convert.ToInt32(Request.QueryString["ps"]);
if (m_intCurrentPage > m_intTotalPage)
m_intCurrentPage = m_intTotalPage;
}
catch
{
//m_intCurrentPage = m_intCurrentPage;
}
}
//set the page content Gets the size of the current page
if (m_intCurrentPage < m_intTotalPage)
{
m_intPageSize = m_intCurrentPage < m_intTotalPage ? m_intPageSize : (m_intArticlelength - m_intPageSize * (m_intCurrentPage - 1));
m_strRet += p_strContent.Substring(m_intPageSize * (m_intCurrentPage - 1), m_intPageSize);
}
else if (m_intCurrentPage == m_intTotalPage)
{
int mm_intPageSize = m_intArticlelength - m_intPageSize * (m_intCurrentPage - 1);
m_strRet += p_strContent.Substring(m_intArticlelength - mm_intPageSize);
}
string m_strPageInfo = "";
for (int i = 1; i <= m_intTotalPage; i++)
{
if (i == m_intCurrentPage)
m_strPageInfo += "[" + i + "]";
else
m_strPageInfo += " <a href=?ps=" + i + ">[" + i + "]</a> ";
}
if (m_intCurrentPage > 1)
m_strPageInfo = "<a href=?ps=" + (m_intCurrentPage - 1) + "> on 1 page </a>" + m_strPageInfo;
if (m_intCurrentPage < m_intTotalPage)
m_strPageInfo += "<a href=?ps=" + (m_intCurrentPage + 1) + "> Under the 1 page </a>";
// The output shows the page Numbers
this.ShowPageNumber.Text = "<p></p>" + m_strPageInfo;
}
else
{
m_strRet += p_strContent;
}
return m_strRet;
}