Nvelocity: determines the details of the last page after the previous page of the home page.

Source: Internet
Author: User

$ Data. totalcount/$ data. pagenum page in total
# If ($ data. pagenum = 1)
<SPAN class = "disabled"> & nbsp; & lt; & nbsp; </span>
<SPAN class = "disabled"> & nbsp; & lt; & nbsp; </span>
# Else
<A href = "stulist. ashx? Pagenum = 1 "> & nbsp; & lt; & nbsp; </a>
# End


# If ($ data. pagenum> 1)
<A href = "stulist. ashx? Pagenum = $ data. FrontPage "> & nbsp; & lt; & nbsp; </a>
# End

# Foreach ($ page in $ data. pagedata)
# If ($ page. currentnum = $ data. pagenum)
<SPAN class = "current"> $ page. currentnum </span>
# Else
<A href = "$ page. href"> $ page. currentnum </a>
# End
# End

# If ($ data. pagenum <$ data. pagecount)
# Set ($ nextpage = $ data. pagenum + 1)
<A href = "stulist. ashx? Pagenum = $ nextpage "> & nbsp; & gt; & nbsp; </a>
# End

# If ($ data. pagenum = $ data. pagecount)
<SPAN class = "disabled"> & nbsp; & gt; & nbsp; </span>
<SPAN class = "disabled"> & nbsp; & gt; & nbsp; </span>
# Else
<A href = "stulist. ashx? Pagenum = $ data. pagecount "> & nbsp; & gt; & nbsp; </a>
# End

Some background ashx code

Int pagenum = 1;
If (context. request ["pagenum"]! = NULL)
{
Pagenum = convert. toint32 (context. request ["pagenum"]);
}
Int totalcount = (INT) sqlhelper. executescalar ("select count (*) from t_stureq where isdel = '0 '");
Int pagecount = (INT) math. ceiling( totalcount/5.0 );
Datatable dt = sqlhelper. executedatatable (@ "select * from (select S. requireid, S. time, C. cname, S. requireaddress, S. requiresex, S. requireprice, S. semail, S. requireinfo, row_number () over (order by S. requireid DESC) as num from t_stureq s left join t_course C on S. cid = C. CID where S. isdel = '0') as s
Where S. Num between @ start and @ end ",
New sqlparameter ("@ start", (pagenum-1) * 5 + 1 ),
New sqlparameter ("@ end", pagenum * 5 ));
Object [] pagedata = new object [pagecount];
For (INT I = 0; I <pagecount; I ++)
{
Pagedata [I] = new {href = "stulist. ashx? Pagenum = "+ (I + 1), currentnum = (I + 1 )};
}
Int FrontPage = pagenum-1;
VaR DATA = new {info = "", person = DT. Rows, totalcount = totalcount, pagenum = pagenum, pagedata = pagedata, pagecount = pagecount, FrontPage = FrontPage };
String html = nvhelper. renderhtml ("Front/stulist.html", data );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.