Arraylist binding to datagrid...

A

AV

I am trying to bind a arraylist with custom Employee
objects to a datagrid. I was debugging this code and
found that the arraylist is populated with 45 Employee
objects.....

Then I do this in the code behind :

// Binding datasource
dgEmployeeList.DataSource = arrEmployeeList;
dgEmployeeList.DataBind();


Here's the HTML view :

<Columns>
<asp:BoundColumn DataField='<%# DataBinder.Eval
(Container.DataItem, "EmployeeID")%>'
HeaderText="EmployeeID">
</asp:BoundColumn>
</Columns>



When the page is run, I get the following error message.

"A field or property with the name '"<%# Databinder.Eval
(Container.DataItem, "EmployeeID" %>"' was not found on
the selected datasource. "


Although in debug mode I successfully retrieved the value
for the EmployeeID from the objects in the arraylist.


I just don't know where am I going wrong


Any help will be highly appreciated.

Thanks
 
A

AV

Thanks Ravi for the link, but this link refers to the
datagrid control dealing with windows forms .....I need
to figure out a way to do this in with ASP. I think there
is a problem with the way the late binding is done using
Databinder.Eval .....or something like that. That's what
I need to get right.

- AV
 

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

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top