asp.net urlpager控件使用攻略

Posted on 2011-08-31 15:26 少康 阅读(...) 评论(...) 编辑 收藏
编辑器加载中...asp.net urlpager控件使用攻略 1、引入UrlPager.dll 2、在web.config中添加 3、注册路由(在Global文件中) using System.Web.Routing;//引入命名空间 在Application_Start中调用方法 void Application_Start(object sender, EventArgs e) { RegisterRoutes(RouteTable.Routes); } 编写注册路由方法 public static void RegisterRoutes(RouteCollection routes) { routes.MapPageRoute("UrlPagingRepeater", "{controller}/{action}/page_{id}", "~/orderde.aspx"); routes.MapPageRoute("UrlPagingBasic", "Home/{pageIndex}", "~/Default.aspx"); } 4、主要是aspx页面上 引入控件 <%@Register Namespace="Webdiyer.WebControls" Assembly="UrlPager" TagPrefix="webdiyer"%> 添加控件 5、主要是cs文件中 调用控件的PageChanged事件进行操作 如:infos = orderInfo.SearchOrder(this.pager1.StartRecordIndex, this.pager1.EndRecordIndex); 6、刚开始要先编写存储过程 ALTER procedure [dbo].[GetOrderPager] @startIndex INT, @endindex INT AS begin WITH orderList AS ( select ROW_NUMBER() OVER (ORDER BY orderid DESC)AS Row,* from [Order].OrderInfo where 1=1 ) select * from orderlist WHERE Row between @startIndex and @endIndex end 彻底完成!

posts - 23, comments - 3, trackbacks - 0, articles - 0

Copyright © 少康