V
viktor9990
I have a datagrid with 2 item templates inside a hyperlink and a label (which
will show the file name and creation date of files which resides on a folder
on the server. I'm using a procedure (GetScannedFiles()) to loop and get the
required information from the folder but don't know how to show this info
inside my datagrid ( dynamically or from my aspx page). I appreciate any
help.
Look my code below.
Here is the code for( MyDatagrid.aspx):
<asp:datagrid id="DGFileScanned" runat="server" Autogeneratecolumns="false" >
<Columns>
<asp:TemplateColumn HeaderText="File Name">
<ItemTemplate>
<div>
<asp:hyperlink ForeColor="blue" Font-Size="10" id="FileName" runat="server" >
.....
</asp:hyperlink></div>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<div>
<asp:Label ID="FileDate" Visible="true" Text="...." Runat="server" />
</div>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
Here is the code behind for (Mydatagrid.aspx.vb)
Private Sub GetScannedFiles()
'Name of the folder which holds the scanned TIFF files (agreements
images)
Dim FolderPath As String =
Server.MapPath("/TrackerAggreement/admin/FilesTIFF/")
Dim source As DirectoryInfo = New DirectoryInfo(FolderPath)
'Get an array of all scanned TIFF files in the source direcotry
Dim sourceFiles As FileInfo() = source.GetFiles("*.tiff")
'Loop to get File Names and Creation Time of the TIFF files in the
source direcotry
Dim i As Integer
For i = 0 To i < (sourceFiles.Length)
'Get the File Name of every scanned TIFF file
Dim FileName As String = Path.GetFileName(sourceFiles(i).FullName)
'Get the Creation Time of every scanned TIFF file
Dim FileDate As String =
Path.GetFileName(sourceFiles(i).CreationTime)
i = i + 1
Next
End Sub
will show the file name and creation date of files which resides on a folder
on the server. I'm using a procedure (GetScannedFiles()) to loop and get the
required information from the folder but don't know how to show this info
inside my datagrid ( dynamically or from my aspx page). I appreciate any
help.
Look my code below.
Here is the code for( MyDatagrid.aspx):
<asp:datagrid id="DGFileScanned" runat="server" Autogeneratecolumns="false" >
<Columns>
<asp:TemplateColumn HeaderText="File Name">
<ItemTemplate>
<div>
<asp:hyperlink ForeColor="blue" Font-Size="10" id="FileName" runat="server" >
.....
</asp:hyperlink></div>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<div>
<asp:Label ID="FileDate" Visible="true" Text="...." Runat="server" />
</div>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
Here is the code behind for (Mydatagrid.aspx.vb)
Private Sub GetScannedFiles()
'Name of the folder which holds the scanned TIFF files (agreements
images)
Dim FolderPath As String =
Server.MapPath("/TrackerAggreement/admin/FilesTIFF/")
Dim source As DirectoryInfo = New DirectoryInfo(FolderPath)
'Get an array of all scanned TIFF files in the source direcotry
Dim sourceFiles As FileInfo() = source.GetFiles("*.tiff")
'Loop to get File Names and Creation Time of the TIFF files in the
source direcotry
Dim i As Integer
For i = 0 To i < (sourceFiles.Length)
'Get the File Name of every scanned TIFF file
Dim FileName As String = Path.GetFileName(sourceFiles(i).FullName)
'Get the Creation Time of every scanned TIFF file
Dim FileDate As String =
Path.GetFileName(sourceFiles(i).CreationTime)
i = i + 1
Next
End Sub