Datagridview上的空排序问题 [英] Null Sort Issues on Datagridview
问题描述
大家好,
我有一个datagridview,它在datetime列上按升序对数据进行排序,
有没有一种方法可以在网格末尾显示空日期(当升序排序时).
请帮忙!!!
由于要求很紧急.
问候,
Sibu Varghese.
Hi All,
I have a datagridview which sorts Data in ascending order on a datetime column,
Is there a way to display null date at the end of the grid(when Sorted Ascending).
Please help!!!
As the requirement is urgent.
Regards,
Sibu Varghese.
推荐答案
尝试一下:
try this one :
Dim sortedList = custList.
OrderBy(Function(c) Not c.LastOrderDate.HasValue).
ThenBy(Function(c) c.LastOrderDate)
DataGridView1.DataSource = sortedList.ToList()
从这里摘录:
http://msmvps.com/blogs/deborahk/存档/2010/10/30/sorting-lists-with-null-values.aspx [ http://www.access-programmers.co.uk/forums/showthread.php? t = 173051 [^ ]
但是,这段代码在C#中,但是值得转换:
http://stackoverflow.com/questions/4921054/sorting-datatable-string-column-but-with-null-empty-at-the-bottom [
Extracted from here :
http://msmvps.com/blogs/deborahk/archive/2010/10/30/sorting-lists-with-null-values.aspx[^]
Also have a look at these pages :
http://www.access-programmers.co.uk/forums/showthread.php?t=173051[^]
However this code is in C# but it worth conversion :
http://stackoverflow.com/questions/4921054/sorting-datatable-string-column-but-with-null-empty-at-the-bottom[^]
Hope it helps.
这篇关于Datagridview上的空排序问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!