Because we support automatic page jump after page selection through the drop-down box, it is a bit like webform's autopostback, and we also need to solve a problem to solve the problem of automatic page jump after selection, we need to carry the previous query conditions and cannot jump after the page is displayed, the query condition disappears.
The connection generated by the tag with a hidden a tag saves the current query condition, and the number of other pages is displayed as "* pageindex *. When we select the drop-down box to skip the page, replace it with the selected value. this "* pageindex * and jump to the current href solves the above problem.
UpperCode
<Text> jump to </text>
<Select id = "pageselect" onchange = "selectchange ()">
@ For (INT I = 1; I <= @ model. totalpagecount; I ++)
{
VaR selected = "";
If (I = model. currentpageindex)
{
Selected = "selected = 'selected '";
}
<Option value = "@ I" @ selected> @ I </option>
}
</SELECT>
{
Dict ["pageindex"] = "* pageindex *";
}
<A style = "display: none" id = "pagelink" href = "@ URL. routeurl (dict)"> </a>
//
<SCRIPT type = "text/JavaScript">
Function selectchange (){
VaR pageselect = Document. getelementbyid ("pageselect ");
VaR pageselectvalue = pageselect. Options [pageselect. selectedindex]. value;
VaR linkdom = Document. getelementbyid ("pagelink ");
VaR href = linkdom. href;
Href = href. Replace ("* pageindex *", pageselectvalue );
Window. Location = href;
}
</SCRIPT>
<Text> page </text>