Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 2nd, 2006, 11:38 PM
Authorized User
 
Join Date: Dec 2003
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ysiline Send a message via Yahoo to ysiline
Default Datagrid fails to sort date column correctly

Hi,

Could anyone help please that my grid handle Date column sort as string:

1/1/2001
2/2/2000
2/3/1989

it seems to be sorted by string value, not date but i am sure that my field is date format and i did format(myDateField,'mm/dd/yyyy') for that field too.

At my asp.net control I did:

<asp:datagrid id="DataGrid1" .......
............
<columns>
<asp:BoundColumn DataField="myDateField" SortExpression="myDateField" ReadOnly="True" HeaderText="Date" DataFormatString="{00:mm/dd/yyyy}">
</asp:BoundColumn>

Any idea???

 
Old July 5th, 2006, 11:15 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Try using DateFormatString ="{0:d}"

 
Old July 11th, 2006, 12:09 PM
Authorized User
 
Join Date: Dec 2003
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ysiline Send a message via Yahoo to ysiline
Default

Well, thank for your idea...I will try.

At this moment I already solved with a hidden "yyyy/mm/dd" formated column....and sort the grid by that hidden column whenever my "shown date" column is clicked for sorting.

Using "yyyy/mm/dd" it will be correctly sorted event when it is considered to be string.

Thanks,






Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding a date field in InsertItemTemplate fails jpullam ASP.NET 2.0 Basics 0 November 14th, 2006 10:50 AM
VBA Column Sort Order and numbers Jack1000 BOOK: Access 2003 VBA Programmer's Reference 1 October 5th, 2006 10:53 PM
How to sort a column in data grid: kenn_rosie ASP.NET 1.0 and 1.1 Basics 1 January 26th, 2006 02:03 PM
Sort column in dynamic table Dreamweaver MX frodedahl Dreamweaver (all versions) 1 September 23rd, 2005 02:59 AM
sort by date mysql crmpicco Classic ASP Databases 1 March 4th, 2005 06:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.