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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid that represents a collection of a base class

Thread ID:

Created:

Updated:

Platform:

Replies:

95662 Jul 23,2010 03:34 AM UTC Aug 12,2010 10:17 AM UTC WPF 6
loading
Tags: GridControl
Alexis Bilodeau
Asked On July 23, 2010 03:34 AM UTC

Hi,

I have the following business objects:

Contact
|
|--- Person
|
|--- Department

I have bound my GridDataControl to a collection of Contacts (through a CollectionView). However, the grid fails when there are both Persons and Departments in the collection.

Let's say I have a Person in the collection. When I add a Department to the underlying collection, the method OnListSourceListChanged (defined in Syncfusion.Linq.Base) throw an InvalidCaseException because it tries to cast the newly added Department into a Person.

Is there a way to force the grid to use the base class instead?

Obviously I display only properties that are defined in the base class.

Any ideas?

Thanks,

Alex

Jeraldes J [Syncfusion]
Replied On July 30, 2010 12:55 PM UTC

Hi Alexis,

Regarding this i have created a sample and have implemented in the grid. Please download the sample from the below link.

http://www.syncfusion.com/uploads/redirect.aspx?file=GDC-Instance Grouping-95662_354a98cb.zip&team=development

Still if you have the issue please modify the sample and we will update on behalf of that.

Let us know if you need any other details.

Regards,
Jeraldes J

Alexis Bilodeau
Replied On August 3, 2010 04:25 AM UTC

Hi,

This isn't exactly what I want. I have made a sample to show exactly what I am trying to do.

In this sample, the business objects are Users, Tasks, Errands and Meetings.

A User is linked to a collection of Tasks through a navigation property defined in the Entity Framework model, thus a Task is linked to a User.

A task can be an Errand or a Meeting, both inherit from the Task class.

The grid shows the tasks for a given User, then you can add either an Errand or a Meeting for this User.

To reproduce the error, you simply have to add an Errand, then a Meeting (or vice versa) for the pre-selected User.

Please let me know if you need any more information since this use case is very important for us and appears in several places within our applications.

Thank you very much,

Alex



Base Class Collection Demo_7226f981.zip

Alexis Bilodeau
Replied On August 6, 2010 02:08 AM UTC

Hi Jeraldes,

Do you have an update on this?

Thank you,

Alex

Jeraldes J [Syncfusion]
Replied On August 6, 2010 01:01 PM UTC

Hi Alexis,

We have referred with your sample regarding your issue. Since you are using the entity collection model, the object that is posted initially will be directly set to the collection property. When you try to insert another object it will not be accepted by the entity collection. This issue is due to the declaration problem in the entity collection not in binding the grid. So please refer with the entity collection operation.

Let us know if you face any other issues.

Regards,
Jeraldes J

Alexis Bilodeau
Replied On August 6, 2010 01:48 PM UTC

Hi,

I have to disagree for two reasons. The first one is that the demo program works just fine if you remove the ItemsSource property from the grid definition (of course nothing displays in the grid, but you can see in debug that the Errands and the Meetings are added to the Entity model).

Second reason is that the exception comes from one of your classes as seen below from the Stack trace:

{"Unable to cast object of type 'Base_Class_Collection_Demo.Meeting' to type 'Base_Class_Collection_Demo.Errand'."}

at Syncfusion.Windows.Data.SourceListWrapper`1.OnListSourceListChanged(Object sender, ListChangedEventArgs e)
at System.ComponentModel.ListChangedEventHandler.Invoke(Object sender, ListChangedEventArgs e)
at
...

Thank you,

Alex

Jeraldes J [Syncfusion]
Replied On August 12, 2010 10:17 AM UTC

Hi Alexis,

For your future reference please follow the incidence id #70851.

We will update you through that incident.

Let us know if you need any other details.

Regards,
Jeraldes J

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

;