在asp.net中按日期排序 [英] sorting by date in asp.net

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

问题描述

嗨朋友们



我们有数据数据。

来自:10/11/2012

至:12/11/2012



自:10/11/2012

to:14/11/2012



自:10/11/2012

to:11/11/2012



来自: :10/11/2012

to:15/11/2012



我们按日期对数据进行排序,最少需要一天。

以上数据显示为



自:10/11/2012总天数:1

to:11 / 11/2012



自:10/11/2012总天数:2

to:12/11/2012



自:10/11/2012总天数:4

to:14/11/2012



来自:10/11/2012总天数:5

to:15/11/2012



此数据按编号排序几天。

怎么可能



提前预付款。

hi friends

we have array of data.
from : 10/11/2012
to : 12/11/2012

from : 10/11/2012
to : 14/11/2012

from : 10/11/2012
to : 11/11/2012

from : 10/11/2012
to : 15/11/2012

we sort data by date which take minimum day.
in above data result display as

from : 10/11/2012 total days: 1
to : 11/11/2012

from : 10/11/2012 total days: 2
to : 12/11/2012

from : 10/11/2012 total days: 4
to : 14/11/2012

from : 10/11/2012 total days: 5
to : 15/11/2012

this data sort by number of days.
how it possible

thanx in advance.

解决方案

http:/ /forums.asp.net/t/1028947.aspx/1 [ ^ ]

http://www.asp.net/mvc/tutorials/getting-started-with-ef- using-mvc / sorting-filtering-and-paging-with-entity-framework-in-an-asp-net-mvc-application [ ^ ]

http://www.hotscripts.com/forums/asp-net/47520-sort-gridview-column-datetime.html [ ^ ]
http://forums.asp.net/t/1028947.aspx/1[^]
http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application[^]
http://www.hotscripts.com/forums/asp-net/47520-sort-gridview-column-datetime.html[^]


改变你的sql命令,从数据库中获取排序数据并绑定/使用它。试试这个:

Alter your sql command, get the sorted data from database and bind/use it. Try this:
SELECT * FROM tbDates ORDER BY DATEDIFF(DAY, FromDate, ToDate) ASC





--Amit



--Amit


这篇关于在asp.net中按日期排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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