订购表数据 [英] Ordering table data

查看:67
本文介绍了订购表数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的希望我选择了正确的论坛类别.

我是新来的. Visual Studio中是否有任何功能可以帮助我对在网站上发布的表中的降序/升序数据进行排序?如果没有,谁可以在自己的网站上拥有这样的系统,并且可以向我发送他的代码?我将不胜感激 很多.

我的计划是要有一个包含6列的表格,例如10行.我希望网站上的客人能够按降序/升序对列进行排序.  

希望得到您的帮助

Gregor

I really hope that I chose right forum category.

I am new at this. Is there any function in Visual Studio that could help me sort descending/ascending data in table I am publishing on my site? If not is there any one who could already has such a system on own website and could send me his code? I would appreciate it a lot. 

My plan is to have a table with 6 columns and e.g. 10 rows. I want my guest on a website to be able sort columns on descending/ascending order.  

Hoping for your help

Gregor

推荐答案

如果使用dataGridView和源表,则最终用户可以使用列标题进行排序,当单击列标题时,该列为有序的箭头指示排序方向.

if you use a dataGridView and a source table, end users can order using the column headers, when the column header is clicked, the column is ordered and a wee arrow indicates the sorting direction.

或使用代码对表进行排序

or to have the table sort with code use

yourDataGridView.Sort(yourDataGridView.Columns["Column_To_Sort"], ListSortDirection.Descending);

yourDataGridView.DataSource = yourDataTable;

希望对您有所帮助!

Hope that helps!


这篇关于订购表数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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