473,399 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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

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:]
Nov 18 '05 #1
1 1098
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

"Angelos Karantzalis" <ak**********@yahoo.com> wrote in message news:<uR**************@tk2msftngp13.phx.gbl>...
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:]

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Oliver Hopton | last post by:
Hello, I'm trying to write a PageableCollection class which implements paging for me so I don't need to rely on the paging provided by the DataGrid as that generates huge viewstate when bound to...
0
by: Steve | last post by:
I have a datagrid that is created at run time DataGrid dgG = new DataGrid(); BoundColumn bcB; dgG.CellPadding = 5; dgG.CellSpacing = 0; dgG.GridLines = GridLines.Both; dgG.CssClass =...
3
by: Just D | last post by:
Hi, If anybody needs to show some data retrieved from the database table, what method is more preferrable? 1. DataSet ds = ...; DataGrid.Data.Source.ds; DataGrid.Bind(); 2. Write a custom...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.