How add row to grid bound to IEnumerable(Of Employee)?

R

Ronald S. Cook

Hi,

I have a grid (Infragistics UltraGrid but I don't think that matters) that
is bound to data source IEnumerable(Of Employee).

How do I add a row to the grid (i.e. to the underlying data source, I
suppose?

I';m used to my data sources being DataTable so easy. Not sure what to do
here.

Thanks,
Ron
 
L

Lasse Vågsæther Karlsen

Ronald said:
Hi,

I have a grid (Infragistics UltraGrid but I don't think that matters)
that is bound to data source IEnumerable(Of Employee).

How do I add a row to the grid (i.e. to the underlying data source, I
suppose?

I';m used to my data sources being DataTable so easy. Not sure what to
do here.

Thanks,
Ron

IEnumerable is a data *source*, not something that you can reliably add
data to. Of course, the object might actually be a List<Employee> or
similar, but unless you know the underlying type (and know that it won't
change at runtime), I would avoid attempting to add something.

Instead, add data to a new List<Employee> and bind to this new list,
which you can easily manipulate:

List<Employee> list = new List<Employee>(enumerable);
grid.DataSource = list;
 

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

Top