gridview not displaying data.

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.
 
P

Paul

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top