资源描述:
《aspnet mvc分页效果》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、在这里我们将谈到的是ASP.NETMVC框架中的一个HTML辅助类,希望通过本文能对大家了解ASP.NETMVC分页有所帮助分页代码:PagerHelper.cs-->1usingSystem;2usingSystem.Collections.Generic;3usingSystem.Collections.Specialized;4usingSystem.Linq;5usingSystem.Web;6usingSystem.Text;7usingSystem.Web.Mvc;8usingSystem.Web.R
2、outing;9usingSystem.Data.Objects.DataClasses;10namespaceSystem.Web.Mvc11{12publicstaticclassPagerHelper13{14///15///分页16///17///18///分页id19///当前页20///分页尺寸21///记录总数22///分页头标签属性23///分页样式24///分页模式25///26publicstaticstringPager(thisHtmlHelperhelper,stringid,intcu
3、rrentPageIndex,intpageSize,intrecordCount,objecthtmlAttributes,stringclassName,PageModemode)27{28TagBuilderbuilder=newTagBuilder("table");29builder.IdAttributeDotReplacement="_";30builder.GenerateId(id);31builder.AddCssClass(className);32builder.MergeAttribut
4、es(newRouteValueDictionary(htmlAttributes));33builder.InnerHtml=GetNormalPage(currentPageIndex,pageSize,recordCount,mode);34returnbuilder.ToString();35}36///37///分页38///39///40///分页id41///当前页42///分页尺寸43///记录总数44///分页样式45///46publicstaticstringPager(thisHtmlHe
5、lperhelper,stringid,intcurrentPageIndex,intpageSize,intrecordCount,stringclassName)47{48returnPager(helper,id,currentPageIndex,pageSize,recordCount,null,className,PageMode.Normal);49}50///51///分页52///53///54///分页id55///当前页56///分页尺寸57///记录总数58///59publicstatic
6、stringPager(thisHtmlHelperhelper,stringid,intcurrentPageIndex,intpageSize,intrecordCount)60{61returnPager(helper,id,currentPageIndex,pageSize,recordCount,null);62}63///64///分页65///66///67///分页id68///当前页69///分页尺寸70///记录总数71///分页模式72///73publicstaticstringPager
7、(thisHtmlHelperhelper,stringid,intcurrentPageIndex,intpageSize,intrecordCount,PageModemode)74{75returnPager(helper,id,currentPageIndex,pageSize,recordCount,null,mode);76}77///78///分页79///80///81///分页id82///当前页83///分页尺寸84///记录总数85///分页样式86///分页模式87///88publics
8、taticstringPager(thisHtmlHelperhelper,stringid,intcurrentPageIndex,intpageSize,intrecordCount,stringclassName,PageModemode)89{90returnPager(helper,id,currentPageIndex,pageSize,recordCount