DataGrid: Bind to an Enumerator of object[]'s

  • Thread starter Angelos Karantzalis
  • Start date
A

Angelos Karantzalis

Hi guys,

I've an Enumerator of object arrays that I need to display on a DataGrid.
Unfortunately, after I set the DataSource to the Enumerator, and call
DataBind(), the DataGrid picks up & displays the public properties of the
object[] instance :(

I'm not able to specify in advance how big the array will be, or what sort
of data is contained in it unfortunately, so I couldn't just create a
"wrapper" object around the array with public properties.

On the other hand, the grid displays a DataSet correctly, which doesn't have
pre-defined columns as well. So there must be a way to tell the DataGrid
both the column names, and how to read them from the "row" object ( my
object[] in this case ) but ... I've no idea how :?

Any pointers pls ?

Cheers,
Angel
O:]
 
A

Amar

Ela na sou po...:)

The best way is to create your own datagrid (inherit .NET datagrid) in
order to manage the data the way you want.

You must create a wrapper there to translate each kind of object Row
you have to display.

Pay attention at OnItemCreated, and OnItemDataBound events of Grid
 

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,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top