ASP.NET - properties or attributes error in Gridview

Asked By Jahir on 08-May-12 12:51 AM
The data source for GridView with id 'GridView1' did not have any properties or attributes from which to generate columns.  Ensure that your data source has content.

using (ServiceReference1.TGTravelServiceClient client = new ServiceReference1.TGTravelServiceClient())

{

Station station = client.getStationList("maddyrafi@gmail.com", "samerafi");

GridView1.DataSource =

new List<Station> { station };

GridView1.DataBind();

}

i take 1 gridview control and put auto generate is true thats all, what kind of error is this ? how to solve this Error ?

S K replied to Jahir on 08-May-12 12:58 AM
This error The data source for GridView with id 'GridView1' did not have any properties or attributes from which to generate columns.  Ensure that your data source has content. means the generated column in gridview are not associated with your datasource So you should check the client.getStationList return valid data which you want to bind with gridview or not.

Venkat K replied to Jahir on 08-May-12 01:02 AM
Simply speaking the columns that you are specified in the gridview should match the data source you are binding here. i.e. stating list. Check whether the columns in both places match each other.
Jitendra Faye replied to Jahir on 08-May-12 01:03 AM
First you need to check does Station class contain get and set attributes or not.

if nor then you will get this error.

Means Class Station should have set and get attributes for it's member