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 8447513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:11:43+00:00 2026-06-10T10:11:43+00:00

I already have the datatable. I just need to fill it in the list

  • 0

I already have the datatable. I just need to fill it in the list view. The problem is that I’m running into this error:

‘System.Web.UI.WebControls.ListView’ does not contain a definition for ‘DisplayMember’ and no extension method ‘DisplayMember’ accepting a first argument of type ‘System.Web.UI.WebControls.ListView’ could be found (are you missing a using directive or an assembly reference?)

I thought the list view had a “DisplayMember” property? This is ASP .NET 4.0, by the way.

namespace Eagle_Replication_Manager
{
    public partial class wfrmMain : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //on page load, I want to get a database table and populate this list view: 
            lvItems.DataSource = GetSourceDBs();

            //This does not work, error here:
            lvItems.DisplayMember = "Description";
        }

        private DataTable GetSourceDBs()
        {
            using (SqlConnection conn = new SqlConnection(AppVars.connectionString))
            {
                using (SqlCommand cmd = new SqlCommand("SELECT [Description] FROM [Warehouse].[dbo].[Items]", conn))
                {
                    conn.Open();

                    cmd.ExecuteNonQuery();

                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        using (DataTable dt = new DataTable())
                        {
                            da.Fill(dt);
                            return dt;
                        }
                    }
                }
            }
        }
    }
}
  • 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-06-10T10:11:45+00:00Added an answer on June 10, 2026 at 10:11 am

    This should work:

        protected void Page_Load(object sender, EventArgs e)
        {
            lvItems.DataSource = GetSourceDBs();
            lvItems.DataBind();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My latest problem is one that I already have a solution for, it just
I already have my azure web role running in cloud using azure sdk 1.6.
I have already have this code to force these URLs to HTTPS: RewriteCond %{HTTPS}
I've got a view with a JQuery DataTable that loads it's content via AJAX
Importing a spreadsheet I have filled a DataTable object with that data and returns
I need to write a code in C# that will select a list of
BACKGROUND I'm writing a method that will (eventually) take as input a System.Data.DataTable and
While executing this method: public static List<T> ToList<T>(DataTable dataTable) { Type type = typeof(T);
I have a DataTable with results already pulled down from a back end. I
I have already developed an application which returns DataTable everywhere. Now my client wants

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.