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.
--
Paul G
Software engineer. 4 2261
Hi Paul,
Please refer to the link below. this shows how you can bind the Grid to a
List. http://forums.asp.net/p/1109165/1704585.aspx
Regards,
Manish www.ComponentOne.com
"Paul" wrote:
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.
--
Paul G
Software engineer.
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" <Pa**@discussions.microsoft.comwrote in message
news:D3**********************************@microsof t.com...
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.
--
Paul G
Software engineer.
ok I will set up properties to retrieve the structure data in the list, thanks!
--
Paul G
Software engineer.
"Eliyahu Goldin" wrote:
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" <Pa**@discussions.microsoft.comwrote in message
news:D3**********************************@microsof t.com...
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.
--
Paul G
Software engineer.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: |
last post by:
Hello,
I have created an ASP.NET 2.0 application that utilized a Gridview Control
to display and update/delete data.
The problem I am having is that the gridview control is displaying the data...
|
by: Hans Merkl |
last post by:
Hi,
Is there a way to show the column headers of a GridView control even if
there is no data? The only thing I see is the EmptyDataTemplate but I would
also like to display the column headers.
...
|
by: |
last post by:
Hello,
Does anyone have an idea on how I can filter the data in the gridview
control that was returned by an sql query?
I have a gridview that works fine when I populate it with data. Now I...
|
by: Jim Katz |
last post by:
I have an application that updates a strongly typed data set at run time.
I'd like to dynamically create a table that connects to a run time data
table. For displaying the data, this works well. ...
|
by: CorporateCoder |
last post by:
Hi,
I am trying to bind the selected value of a databound dropdown box in a
databound gridview control to the value being displayed in the template
column the dropdown box has been added to. ...
|
by: srinivas |
last post by:
Hi,
I have binded a dataset to a gridview control at run time.
I'm fetching 5 columns from the database.
But while displaying it on the screen i want to show only 3 columns.
I tried with...
|
by: Greg Lyles |
last post by:
Hi all,
I'm trying to develop an ASP.NET 2.0 website and am running into some
real problems with what I thought would be a relatively simple thing
to do.
In a nutshell, I'm stuck on trying to...
|
by: moni |
last post by:
Hi,
I was hoping to know how I could get the text value of a gridview row.
My code is this way:
<asp:GridView ID="GridView1" runat="server"
AllowSorting="True" AutoGenerateColumns="False"...
|
by: Polaris |
last post by:
Hi Experts:
I'm using asp.net 2.0 with Visual Studio 2005. I'm trying to use the
GridView to display data. I need to programmatically add rows into the
GridView. So far could not find a way...
|
by: gnewsgroup |
last post by:
I've googled and tried various approaches, but could not resolve this
problem. The article at MSDN: Displaying Images in a GridView Column
only presents a simple case where all data (including the...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |