gridview not displaying data.

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi I get the error (the data source for the gridview does not have any
properties from which do generate columns)
I am binding the data as follows, errors out on the databind line.
The linksDataRepository is retrieved from a session variable and is working
ok.


linksDataRepository = (List<structRepo>)Session["linksDataRepository"];
if (linksDataRepository != null)
{
gridview.DataSource = linksDataRepository;//
gridview.DataBind();
}
and for the gridview I have
<Columns>
<asp:BoundField DataField="abspath" HeaderText="absolute path" />
<asp:BoundField DataField="description" HeaderText="description" />
<asp:BoundField DataField="icount" HeaderText="Count" />
<asp:BoundField DataField="url" HeaderText="Url" />
</Columns>
as the structRepo is a structure with data abspath (string), description
(string), icount (Integer), url (string). Any ideas?
thanks.
 
ok I will set up properties to retrieve the structure data in the list, thanks!
--
Paul G
Software engineer.


Eliyahu Goldin said:
You can databind to properties, not to structure fields.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Paul said:
Hi I get the error (the data source for the gridview does not have any
properties from which do generate columns)
I am binding the data as follows, errors out on the databind line.
The linksDataRepository is retrieved from a session variable and is
working
ok.


linksDataRepository = (List<structRepo>)Session["linksDataRepository"];
if (linksDataRepository != null)
{
gridview.DataSource = linksDataRepository;//
gridview.DataBind();
}
and for the gridview I have
<Columns>
<asp:BoundField DataField="abspath" HeaderText="absolute path" />
<asp:BoundField DataField="description" HeaderText="description" />
<asp:BoundField DataField="icount" HeaderText="Count" />
<asp:BoundField DataField="url" HeaderText="Url" />
</Columns>
as the structRepo is a structure with data abspath (string), description
(string), icount (Integer), url (string). Any ideas?
thanks.
 
Back
Top