如何在网格视图中对多个列进行排序 [英] how to sort multiple colum in grid view

查看:71
本文介绍了如何在网格视图中对多个列进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,请告诉我们如何使用示例

Dear all please tell to sort multiple column in grid view with example

推荐答案

如果您对表的任何列使用主键然后将始终根据该列进行排序.
它是主键的属性!

或者简单地,您可以对该列使用order by子句
If you use primary key to any column of the table then it will always be sorted according to that column all get sorted.
Its the property of primary key!

or simply you can use order by clause to that column


您必须保存要用来对网格视图记录排序进行排序的多列名称.保存按排序要求所需的用逗号(,)分隔的列名.
You have to save the multiple column name by which you want the sorting of the grid view record sorting. Save the column name separated by comma(,) as it is required as per sorting requirement.
private string GridViewSortExpression
    {
        get
        {
            return ViewState["SortExpression"] as string ?? string.Empty;
        }
        set
        {
            if (ViewState["SortExpression"] == null)
                ViewState["SortExpression"] = value;
            else if (ViewState["SortExpression"].ToString().Contains(value) == false)
                ViewState["SortExpression"] += "," + value;

        }
    }


看一下本文:通过允许多选和多列排序扩展GridView [^ ]


Have a look at this article: Extending GridView by allowing Multiple Selections and Multi Column Sort[^]


http://dotnetslackers.com/articles/gridview/SortingaGridviewwithmultipleColumns. aspx [ ^ ]
通过允许多选和多列排序扩展GridView [ ^ ]
http://stackoverflow.com/questions/1429261/hierarchical-multi- column-sorting-for-the-net-gridview [ ^ ]
http://dotnetslackers.com/articles/gridview/SortingaGridviewwithmultipleColumns.aspx[^]
Extending GridView by allowing Multiple Selections and Multi Column Sort[^]
http://stackoverflow.com/questions/1429261/hierarchical-multi-column-sorting-for-the-net-gridview[^]


这篇关于如何在网格视图中对多个列进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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