asp

位置:IT落伍者 >> asp >> 浏览文章

ASP无组件分页实现思路及代码


发布日期:2021年01月16日
 
ASP无组件分页实现思路及代码

MVC下

后台代码代码如下:public ActionResult sys(string page){if (page == null){string sql = "select top * from dingdinfo ORDER BY dingdh desc";ViewData["ds"] = drresultSet(sql "dingdinfo");}if (page != null){int pageSL = ConvertToInt(page);string sql = "select top * from dingdinfo where id not in (select top " + (pageSL ) * + " id from dingdinfo order by dingdh desc )ORDER BY dingdh desc";ViewData["ds"] = drresultSet(sql "dingdinfo");}//计算pageCountstring sql = "select * from dingdinfo";int pageCount = drresultCount(sql"dingdinfo");int Chu = ConvertToInt(pageCount / );int yuS = ConvertToInt(pageCount % );if (pageCount > ){int pageJG = Chu;if (yuS != ){pageJG = Chu + ;ViewData["jg"] = pageJG;}else{ViewData["jg"] = pageJG;}}return View();}页面显示JS代码代码如下:<script type="text/javascript">//分页function Page(id) {windowlocation = "/bookIndex/sys/?page=" + id;}</script>HTML代码代码如下:<td><% int count =ConvertToInt(ViewData["jg"]);if (count != ){for (int i = ; i <=count; i++){ %><a href = "#" onclick="Page(<%:i%>)"><%:i%></a><% }}%></td>               

上一篇:2种解决ASP运行出现脚本超时的办法

下一篇:asp添加数据代码