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

  • Home
  • SEARCH
  • 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 8770203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:31:01+00:00 2026-06-13T17:31:01+00:00

This is the first time that I’m doing this, so I need a little

  • 0

This is the first time that I’m doing this, so I need a little bit of help,

I have this code behind:

List<Trucks> FinalListOfTrucks = new List<Trucks>();
    public class Trucks
    {
        public string Placa;
        public string Lock;
        public string Event;
        public DateTime Date;
        public string TipoCamion;
        public string Person;
        public string MissedDate;
    }

    protected void btnProcess_Click(object sender, EventArgs e)
        {
            Trucks item = new Trucks();
            item.Placa = "MA2323";
            item.Lock = "lock1";
            item.Event = "Event1";
            item.Date = DateTime.Now;
            item.TipoCamion = "TRUCK1";
            item.Person = "JULIAN";
            item.MissedDate = "";
            FinalListOfTrucks.Add(item);

            gvOriginal.DataSource = FinalListOfTrucks;
            gvOriginal.DataBind();
}

in design:

<asp:Button ID="btnProcess" runat="server" Text="Process" 
        onclick="btnProcess_Click" />
    <asp:GridView ID="gvOriginal" runat="server"></asp:GridView>

But trying to run the web app, I’m getting the following error:

The data source for GridView with id 'gvOriginal' did not have any properties or attributes from which to generate columns. Ensure that your data source has content.

Do I have to do anything else, to make this work?

  • 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-13T17:31:02+00:00Added an answer on June 13, 2026 at 5:31 pm

    Databinding relies on using properties rather than fields, as the error message you got indicates. You can easily change your code so that Trucks uses properties instead:

    public class Trucks
    {
        public string Placa { get; set; }
        public string Lock { get; set; }
        public string Event { get; set; }
        public DateTime Date { get; set; }
        public string TipoCamion { get; set; }
        public string Person { get; set; }
        public string MissedDate { get; set; }
    }
    

    If you make that change everything should work.

    Note that there are a number of subtle differences between properties and public fields. A property is effectively syntactic sugar around methods, so public string Placa {get;set;} would be transformed into something similar to:

    private string _placa;
    public string GetPlaca() { return _placa; }
    public void SetPlaca(string value) { _placa = value; }
    

    As for the differences between methods and fields, that’s probably beyond the scope of this question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database that is currently sharded. This is the first time that
This is the first time I have attempted to create a .dll, that will
This is the first time that I have attempted to add some localization into
This is my first time that I use WCF and Android. So, sorry for
That's my first time posting on stackoverflow. I've been finding usefull answers on this
This is the first time that this error has come up. I am using
This is the first time that I'm upgrading the iphone sdk and am wondering
This is the first time that I use transactions and I just wonder am
So here I have this first time app I'm working on. When I run
I got this code that should help me save an image to the servers

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.