Why am I getting the error: 'ListWriteTime' was not found on the selected data source.

  • Thread starter Thread starter Steve Kershaw
  • Start date Start date
S

Steve Kershaw

Hello,

I'm trying to bind a DirectoryInfo array to a GridView
(.DataBind();).
Whenever I hit the gridDirList.DataBind(); method I get the error:

A field or property with the name 'ListWriteTime' was not found on the
selected data source.

Can somebody explain this error and what I can do to avoid it?
I've googled this error and 'ListWriteTime' and I don't get any
results.

Thanks so much.

Steve
 
Hello,

I'm trying to bind a DirectoryInfo array to a GridView
(.DataBind();).
Whenever I hit the gridDirList.DataBind(); method I get the error:

A field or property with the name 'ListWriteTime' was not found on the
selected data source.

Can somebody explain this error and what I can do to avoid it?
I've googled this error and 'ListWriteTime' and I don't get any
results.

Thanks so much.

Steve

So Sorry I got a little too quick with the mouse.
I forgot to add my code:

// Define the current directory
DirectoryInfo dir = new DirectoryInfo(path);

// Get the Directory info arrays for the dir and files
FileInfo[] files = dir.GetFiles();
DirectoryInfo[] dirs = dir.GetDirectories();

// bind to the GridView
gridDirList.DataSource = dirs;
gridDirList.DataBind();

Thanks again.

Steve
 
Hi Steve,


The error message means that your aspx file tries to find a property
named ListWriteTime in each DirectoryInfo object and to output the value
of that property somewhere in your aspx file. However, DirectoryInfo
does not have a property named ListWriteTime (with an i).
I suppose you meant LastWriteTime (with an a) and just mistyped it in
your aspx file.

Hope this helps.

Cheers,

Roland
 
Back
Top