如何在asp.net中对gridview的当前页面进行排序 [英] How to sort current page of gridview in asp .net

查看:94
本文介绍了如何在asp.net中对gridview的当前页面进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有网页视图,页面大小为20,我的数据正在排序整个网格视图记录

但我希望记录按页面排序

,例如if第1页包含a,b,c,d记录和第2页包含e,f,g,h

比排序第2页时只记录应排序e,f,g,h并且不应该排序第1页的记录a,b,c,d

I am having grid view with page size 20 and my data is sorting whole grid view record
but i want the record should sort by page wise
for e.g if page 1 contains a,b,c,d records and page 2 contains e,f,g,h
than while sorting of page 2 only record should sort e,f,g,h and should not sort the record of 1st page a,b,c,d

推荐答案

<asp:GridView ID=" productsGridView" Runat="server"
        DataSourceID="productDataSource" AutoGenerateColumns="False"
           AllowSorting="True" BorderWidth="2px" BackColor="White"
           GridLines="None" CellPadding="3"
           CellSpacing="1" BorderStyle="Ridge" BorderColor="White"
           AllowPaging="True">







ie,AllowSorting = True




ie, AllowSorting=True


将网格视图AllowSorting的属性设置为true
Set the proprty of grid view AllowSorting to true


参考此网址进行排序,



http://www.dotnetfox.com/articles/g ridview-sorting-example-in-Asp-Net-using-C-Sharp-1082.aspx [ ^ ]

http://www.dotnetgallery.com/kb/resource12-How -to-implement-paging-and-sorting-in-aspnet-Gridview-control.aspx.aspx [ ^ ]
Ref this url for sorting,

http://www.dotnetfox.com/articles/gridview-sorting-example-in-Asp-Net-using-C-Sharp-1082.aspx[^]
http://www.dotnetgallery.com/kb/resource12-How-to-implement-paging-and-sorting-in-aspnet-Gridview-control.aspx.aspx[^]


这篇关于如何在asp.net中对gridview的当前页面进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆