This is a follow up to my previous question: Filter DirectoryInfo files by date in asp.net
I have a gridview that is populating data from DirectoryInfo.
However, I only want to display certain columns, and customize the column names and the hyperlink value in the row.
My code is:
Dim files As FileInfo() = New DirectoryInfo(strDirectoryPath).GetFiles().Where(Function(x) x.LastWriteTime >= (dtStartDate) AndAlso x.LastWriteTime <= (dtEndDate)).ToArray()
For Each col In Gridview.Columns
If InStr(1, ",name,Extension,LastWriteTime,", "," & col.ColumnName.ToString.Trim & ",") > 0 Then
Dim hfield As HyperLinkField = New HyperLinkField()
hfield.DataTextField = col.ColumnName
hfield.HeaderText = "<table><tr><td align=""center"">" & col.ColumnName & "</td></tr></table>"
gvInvoiceList.Columns.Add(hfield)
i += 1
End If
Next
Question:
How can I loop through the columns, to display only "name", "extension" and LastWriteTime?