I've got some homework to do, but I cannot go through this issue. I want my .aspx page to display my database records, one below another. In order to do this I use a GridView, while the data is stored in an ArrayList. This ArrayList is composed of User objects, where each user has a first name, last name etc. (all the common stuff).
My code looks like this:

GridView myDataGrid = new GridView();
        myDataGrid.DataSource = myArrayList;
        myDataGrid.DataBind();

When I run thi thing in the browser, it keeps telling me: "The data source for GridView with id '' did not have any properties or attributes from which to generate columns. Ensure that your data source has content." - which is funny, since I know for sure that my arraylist contains exactly 4 User objects...

Could somebody help me please? What is the error in my code?
Tanks in advance.

the error is fair, you have to tell which property to be bound to columns in gridview. your user object has to have public properties so that the gridview can populate the column values. the properties must be in the form of property not a field. so not something like public string abc but like public string abc{ set ; get;}
try what i told, if there is still a problem let me know.

commented: Thank you for the nice explanation +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.