解决问题:.Net分页
1.在此页下面下载dll分页文件,将下载的dll文件拖入vs工具箱,再从工具箱拖入到页面中需要引用的位置;
2.拖入后如下面代码所示,设置一个id,这里设为anp:
<span style="font-family:Microsoft YaHei;font-size:14px;color:#3366ff;"><span style="font-family:Microsoft YaHei;font-size:14px;color:#3366ff;"><webdiyer:AspNetPager ID="anp" runat="server" onpagechanged="anp_PageChanged"></webdiyer:AspNetPager></span></span>
3.存储过程中设置两个参数:@start 、 @end;
<span style="font-family:Microsoft YaHei;font-size:14px;color:#3366ff;"><span style="font-family:Microsoft YaHei;font-size:14px;color:#3366ff;">with temptbl as ( select ROW_NUMBER() OVER(order by createTime desc) as Row,n.id,n.title,n.createTime,ca.name from news n inner join category ca on ca.id = n.caId where n.title like '%'+@title+'%') SELECT * FROM temptbl where Row between @start and @end end</span></span>
4.设计视图下双击分页条,在对应方法中调用存储过程的时候传入anp.StartRecordIndex,和anp.EndRecordIndex ;
6.设置一下属性:PageSize ;