Convert EntityCollection to Typed List

Posts   
 
    
pvilanova
User
Posts: 24
Joined: 01-Apr-2007
# Posted on: 11-Aug-2007 01:01:55   

Hi all:

I have an EntityCollection, and i need to databind it to a grid for editing. I cannot databind it directly because previously i need to make some computations.

Imagine this:

public DataTable BuildComponents(EntityCollection<ComponentEntity> components) { DataTable ret = BuildComponents(); DataRow dr = null;

        foreach (MixComponentEntity comp in components)
        {
            dr = ret.NewRow();

            dr[Column1] = someComputation(comp.Field1);
            dr[Column2] = otherComputation(comp.SerieData.Field1);
            //SerieData is a related entity
            ...

            ret.Rows.Add(dr);
        }

        return ret;
    }

Well, i need, in some way, to generate a DataTable (or a TypedList) that is "binded" with original fields. For instance: I need to edit in the grid comp.Field1 value.

Many thanks, and Regards.

Posts: 254
Joined: 16-Nov-2006
# Posted on: 12-Aug-2007 01:02:29   

Please can you explain your specific issue in more detail please. i.e.

because previously i need to make some computations

or

generate a DataTable (or a TypedList) that is "binded" with original fields

What do you mean original fields?

pvilanova
User
Posts: 24
Joined: 01-Apr-2007
# Posted on: 12-Aug-2007 01:21:50   

Thanks for the reply.

I've solved the problem.

Thanks. Regards.