CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > starter_kits_and_source_projects.club_web_site_starter_kit Tags:
Item Type: NewsGroup Date Entered: 9/21/2006 4:43:26 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 0 Views: 14 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
1 Items, 1 Pages 1 |< << Go >> >|
JimHamade
Asp.Net User
Display of files stored in DIR requires complex formatting9/21/2006 4:43:26 AM

0/0

Hello everyone,

I'm new here and hope that someone can help.  I'm also new to .NET & VB so please bear with my need for hand holding.

 I've got files being uploaded from my web server to a file server.  To avoid filename duplication, I'm adding a date/time tag to the filename just before the file extension (if there's one).  All this is working fine (upload).  The date/time tag has the following format "_YYYYMMDDHHMMSS".  Thus, a filename would look like "Hello_20060920192530.txt".  Note that there is not always a filename extension, depending on what has been uploaded.

But when I want to list the files, I want to strip the date/time tag before the filename is displayed and make the filename a hyperlink to the file's UNC name when it's clicked.  Thus, the above example would be displayed as "Hello.txt" with the hyperlink pointing to the full UNC name.

Here's what I have so far.  Any help would be greatly appreciated.  Thanks for all the help.

<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.IO" %>

<script language="VB" runat="server">
  Sub Page_Load(sender as Object, e as EventArgs)
 
 'Put together path and file name
 Dim strPath as string
 Dim strDirName as string
 
 strPath = "\\myserver\PROJECTS\"
   
 strDirName = Dir(strPath, vbDirectory) ' Retrieve the first entry.
 
 if strDirName <> "" ' The folder exists

 Dim dirInfo as New DirectoryInfo(strPath)

 Dim xFiles
 xFiles = dirInfo.GetFiles("*.*")

 Dim fileDate(xFiles.GetUpperBound(0)) as Date

 'Get the Last Written Time of each file
 For i as Integer = 0 to xFiles.GetUpperBound(0) step 1
  fileDate(i) = xFiles(i).LastWriteTime
 Next i

 'Use the Last Written Time as the key on which to sort the files
 'Method syntax is PAIR of one-dimensional arrays where 1st array contains keys used to sort 2nd array
 Array.Sort(fileDate, xFiles)

 'Reverse the sort order if required
 'Array.Reverse(xFiles)

     articleList.DataSource = xFiles

 articleList.DataBind()
 
 else
  response.Write("<b>No files have been attached to this request.</b>")
 end if

  End Sub
</script>

<asp:DataGrid runat="server" id="articleList" Font-Name="Arial"
    AutoGenerateColumns="False" AlternatingItemStyle-BackColor="#eeeeee"
    HeaderStyle-BackColor="#cccccc" HeaderStyle-ForeColor="White"
    HeaderStyle-Font-Size="15pt" HeaderStyle-Font-Bold="True">
  <Columns>


    <asp:HyperLinkColumn DataTextField="Name" HeaderText="Name" Target="_self" DataNavigateUrlField="FullName" ItemStyle-HorizontalAlign="left" DataNavigateUrlFormatString="{0:d}" ItemStyle-Width="400px" />

    <asp:BoundColumn DataField="LastWriteTime" HeaderText="Date" ItemStyle-HorizontalAlign="left" DataFormatString="{0:d}" ItemStyle-Width="100px" />

    <asp:BoundColumn DataField="Length" HeaderText="Size" ItemStyle-HorizontalAlign="left" DataFormatString="{0:#,### bytes}" ItemStyle-Width="150px" />

  </Columns>
</asp:DataGrid> 

<html>
<body>
</body>
</html>

1 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
The New York Times Guide to Essential Knowledge: A Desk Reference for the Curious Mind Authors: Times The New, The New York Times, Pages: 1096, Published: 2004
The Telecommunications Illustrated Dictionary Authors: Julie K. Petersen, Pages: 1073, Published: 2002
Building Enhanced HTML Help with DHTML & CSS Authors: Jeannine M. E. Klein, Pages: 380, Published: 2001
Computer Processing of Remotely-sensed Images: An Introduction Authors: Paul M. Mather, Pages: 292, Published: 1999
Using C-Kermit: Communication Software Authors: Frank Da Cruz, Christine M. Gianone, Pages: 648, Published: 1997

Web:
System for selecting desired entry information from directory ... The user is thus not required to perform complex operations in utilizing external .... 2 is stored in directory database 12 , and the system user makes an ...
#!/usr/local/bin/perl # # Anthony's WWW Counter (v1.3 ... A user ".dat" file file can specify the format and the location of these ... EG: the counter image are stored in the directory "/home/user/digits" # with ...
Red Hat Directory Server Deployment Guide: Chapter 5 Designing the ... Indexes are files stored in your directory databases. ... or may search your directory in a different language, or may require data in a particular format. ...
File directory structure generator and retrevial tool with ... The module is to display the selected files in an operating system directory, as well as the related information from the File Base 14 that was stored in ...
Language information and text direction Start tag: required, End tag: required. Attribute definitions. dir = LTR | RTL [ CI] .... formatting, to the formatting obtained by explicitly adding a dir ...
Creating a simple portlet The /WEB-INF directory stores the portlet descriptor document and all of the runtime executable JAR files and classes that the packaged portlet requires. ...
INTREPID file and directory structure (R05) associating with a field to display lookup results. instead of stored value. a DDF file ...... The export format file for a dataset has standard syntax, is ...
Flexense - FlexTk File Management Each of them may be selected to display bookmarks, file filters, ... To add a new file system bookmark, browse to the required directory and press the ...
Sun ONE Directory Server 5.2 Getting Started Guide: Chapter 2 ... The LDIF format is described in detail in the Sun ONE Directory Server Reference Manual. ... Indexes are files stored in the directory databases. ...
Linux Command Directory: rsync Specify where files created by the --backup option are stored. ... Display information about each file transferred in a format specified by % sequences; ...




Search This Site:










getweekofyear

vs 2003 to vwd express

detecting from masterpage if page loads a certain control

execute permission denied on object 'getportalbyalias'

source control / exclude a folder from my project

impersonation with iis and sql server

using migration assistant with visual studio 2005

plz help .ascx, .aspx, web.config !! how to create

language usually used

using public variable via class - confirming my thought process

parse error

detect the client's browser

service pack 1

camtasia flash videos

search and replace

(screen shots) how to quickly debug dnn4

where to get asp.net 2.0 beta 2

formatting

2 questions about dnn v4.0.2

asp.net 2.0 master page issue

auto-login

problem with a reference to com objects

isa server

dotnetnuke.sln file causes redirect to install/install.aspx?...

how do you efficently debug custom modules?

treeview, making the selected index show on screen

populate a grid on an iframe

problems after 3.1.1 upgrade - please help!

dnn 3 with sql express 2005 and net 2 framework

creating reports with asp.net

 
All Times Are GMT