We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Binding Complex Object Collections to Grid?

Thread ID:

Created:

Updated:

Platform:

Replies:

12167 Mar 23,2004 12:46 PM UTC Mar 23,2004 01:19 PM UTC WinForms 2
loading
Tags: GridControl
Daws
Asked On March 23, 2004 12:46 PM UTC

Hi, I''ve just downloaded the trial version of the Essential grid and am unsure which way to best approach my problem. Here is the issue: I have a ObjectCollection that implements IBindingList. The ObjectCollection contains ClassA objects. ClassA has a property that is a ClassB object. In the Grid I would like to have columns for the following: ClassA.Prop1, ClassA.Prop2, ClassA.ClassB.Prop1, ClassA.ClassB.Prop2 The System.Windows.Forms.DataGrid cannot do this because you can only have 1 DataSource for the grid (ClassA) and the MappingName''s for the columns must be properties of that DataSource (ie. ClassB and not ClassB.Prop1). Here are the 3 ways which I see this could work with the EssentialGrid, please tell me what is the best choice. 1) Use databound cells, iterate through my entire collection and set up the databindings for each cell individually. 2) Use the virtual grid and write the QueryCellInfo/SaveCellInfo handlers. 3) Use the GridDataBoundGrid - how? Does it have the same limitations as the .NET DataGrid wrt MappingName''s? Seems like option 3 would be best if it is possible, but I don''t want to sink a lot of time into it if it won''t work. Thanks in advance for your assistance. Regards, Daws

Administrator [Syncfusion]
Replied On March 23, 2004 01:02 PM UTC

You will not be able to just set properties and get this to work using any of our grids. Below is one solution that using a GridDataBoundGrid and QueryCellInfo/SaveCellInfo to handle this problem. It uses a ITypedList implementation on the main collection to make things a little more general. You could simplify things (in the short run) by hard coding things, but using the typedlist shows how you might handle it in a more general way. 9406_742.zip

Daws
Replied On March 23, 2004 01:19 PM UTC

Thanks for the quick response. I can already see how this is going to work very nicely. Regards, Daws

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;