从第3行开始排序gridview [英] sorting gridview from 3rd row onwards

查看:88
本文介绍了从第3行开始排序gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我确实要求对网格视图进行排序。但是我的gridview有自定义标题。

即gridview 1row --->例如:-companyname

gridview第二行--->例如:-details从date到todate和总金额:-xxx

gridview第3行--->

s.No empname电子邮件电话工资等...

为了做上面的格式我已经使用了gridview的rowcreated事件并动态插入gridview列。所以工作正常。我希望在gridview中显示的格式已经来了...但现在我需要对来自第3行的列应用排序..并且我已将autogenerate列设置为false并且没有绑定字段或模板字段来指定排序表达式到gridview。我搜索了很多帖子但没有得到正确答案,任何人都可以告诉我怎么做以完成我的任务..

hi all,
i do have a requirement that to sort the grid view. but my gridview has customized headers.
i.e gridview 1row--->Eg:-companyname
gridview 2nd row--->Eg:-details from date to todate and total amount:-xxx
gridview 3rd row--->
s.No empname email phone salary etc...
in order to do above format i have used rowcreated event of gridview and inserting gridview columns dynamically..all working fine. the format which i want to show in gridview has come... but now i need to apply sorting on columns which are from 3rd row.. and i have set autogenerate columns false and there are no bound field or template field to specify sort expression to gridview. i have searched so many posts but didn't get proper answer,,can any one tell me how to do in order to complete my task..

推荐答案

我可以没有可视化您的网格,但我从您的帖子中假设您从第3行开始实际结果集!甚至在填充网格视图之前,您可以进行排序的一种方法。



您可以从数据源中按排序顺序选择行。如果要在某些集合中存储数据,则可以在类中实现比较逻辑,并在集合对象上调用sort方法。
I could not visualize your grid , but I assume from your post that from 3rd row your actual result set starts! One way you can approach sorting is even before populating the grid view.

You can select the rows in sorted order from your data source. If you are storing data in some collections you can implement comparison logic in your class and invoke sort method on the collection object.


这篇关于从第3行开始排序gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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