Login  
Search All Forums
Dart Home | PowerTCP FTP for .NET | Custom Development Reply | PowerTCP FTP for .NET Topics | Forums   
AuthorForum: PowerTCP FTP for .NET
Topic: Sorting dir and file list help
masgmasg

From: asgasg, Uruguay
Posts: 13
Member Since: 01/18/04
posted January 18, 2004 10:53 AM

Hi,
Has anybody a clue on how to easily sort dir and file listings in for example based on: name,date,size

Regards Magnus
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted January 18, 2004 10:58 AM

The sample listview client does it. Take a look at the code that gets executed when the column header is clicked.
masgmasg

From: asgasg, Uruguay
Posts: 13
Member Since: 01/18/04
posted January 18, 2004 12:00 PM

That example is based on a Windows.Form listview.
That's not usable in a asp.net application?

The only way it seem is to change the sample asp.net datatable/datarow -> dataview/datarowview?
But thats a lot of rewriting code.

/Magnus
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted January 18, 2004 2:24 PM

Well, there's no way to do it automatically with our library, but there are many classes that implement sorting in the .NET framework. I'd suggest you start looking at some of those options. Try searching for 'sortable' in the .NET framework help.
masgmasg

From: asgasg, Uruguay
Posts: 13
Member Since: 01/18/04
posted January 19, 2004 8:20 AM

I rewrote the testapp and added dataview support on the datatable/datarow objects, then i managed to get it sorted thru the dataview.
Took some time, but was worth it.
The only sad thing now is that i noticed the TimeStamp function doesnt extract the Year of the files/folders.
Had to hardcode the year to the current year always, with lots of errors in sorting as a result..
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted January 19, 2004 8:46 AM

Hi,
It will not always be the case that the year is the current year. It may also be the previous year, depending on the current date.

In other words, if you had a file with a December timestamp and a time specified (no year), it would be from 2003, not 2004, because Dec 2004 has not arrived yet.

-ken

masgmasg

From: asgasg, Uruguay
Posts: 13
Member Since: 01/18/04
posted January 19, 2004 8:52 AM

Jepp, that's exactly my problem now. And noone here seems have to found a solution to this. Unless stop using the TimeStamp function, and start using another file listing method...

K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted January 19, 2004 9:12 AM

Hi,
Just compare the file's date to the current date, and assign the year appropriately.
-ken
masgmasg

From: asgasg, Uruguay
Posts: 13
Member Since: 01/18/04
posted January 19, 2004 9:45 AM

Good idea. Thanks.
Reply | PowerTCP FTP for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX