Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7612529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:56:04+00:00 2026-05-31T01:56:04+00:00

I have the following simple page; <%@ Import namespace=System.IO %> <script runat=server> int pageSize

  • 0

I have the following simple page;

    <%@ Import namespace="System.IO" %>

<script runat="server">
    int pageSize = 10;
    int pageNum = 1;

    protected override void OnInit(EventArgs e)
    {
        var currentPage = Directory.GetFiles(@"C:\mypath", "*.pdf").Skip((pageNum - 1) * pageSize).Take(pageSize).OrderBy(c => c).ToArray();
        Listview1.DataSource = currentPage;
        Listview1.DataBind();

        base.OnInit(e);
    }

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Test project</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ListView ID="Listview1" runat="server">
        <LayoutTemplate>
            <table cellpadding="0" cellspacing="0">
                <tr>
                    <td>Titel</td>
                    <td>Size</td>
                </tr>
                <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
            </table>
        </LayoutTemplate>
        <ItemTemplate>
            <tr>
                <td><a href=''><%#Eval("Name") %></a></td>
                <td>0 kb</td>
            </tr>
        </ItemTemplate>
    </asp:ListView>
    </form>
</body>
</html>

How do i get Filename, size, path etc into my Listview. If i just had a simple for each directly on the GetFiles, i could do something like

FileInfo f = new FileInfo(pdfFile);
long pdfSize = f.Length;
Response.Write(Path.GetFileName(pdfFile) + " - " + pdfSize.ToString() + "<br/>");

But how do i achive this in my ListView?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:56:06+00:00Added an answer on May 31, 2026 at 1:56 am

    You are selecting the paths to the files not the files itself. Hence you cannot get the FileInfo‘s properties what raises your exception “DataBinding: ‘System.String’ does not contain a property with the name ‘Name'”

    This should work:

    var currentPage = Directory.GetFiles(@"C:\mypath", "*.pdf").Skip((pageNum - 1) * pageSize).Take(pageSize).OrderBy(c => c).ToArray();
            .Skip((pageNum - 1) * pageSize)
            .Take(pageSize)
            .OrderBy(c => c)
            .Select(path => new System.IO.FileInfo(path)).ToArray();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following simple script on a page <!DOCTYPE html PUBLIC -//W3C//DTD XHTML
We have the following simple Stored Procedure that runs as an overnight SQL server
I have the following simple python test script that uses Suds to call a
I have the following simple Java code: package testj; import java.util.*; public class Query<T>
I have the following simple script for backing up my website files and db.
i have the following simple script <input class=input type=text name=password style=color: #797272; value= <?php
I came across the following issue: I have a main simple page on which
I have the following simple code: import urllib2 import sys sys.path.append('../BeautifulSoup/BeautifulSoup-3.1.0.1') from BeautifulSoup import
What changes do I have to make to the following simple HTML page to
I have this simple Jsp page: <%@ page language=java import=java.awt.Color%> <% Color background =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.