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

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
 
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

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
 
R

Roland Dick

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top