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

Binding CustomTypes to GridGroupingGrid fails if inherited

Thread ID:





103673 May 23,2012 03:42 PM UTC May 29,2012 09:24 AM UTC WinForms 2
Tags: GridControl
Mr. Sascha Wald
Asked On May 23, 2012 03:42 PM UTC

Hi there,

installed ES2012 V2, I have a gridgroupinggrid (GGC) that I try to bind to businessObjects.

Mapping and filling TableDescriptor is done via iterating through ObjectProperties

        Private Sub InitializeGrid()
            Dim computerPropertyType As Type = GetType(IMyObject)
            Dim assetPropertyType As Type = GetType(IBaseClass)
            Dim computerItemProperty As PropertyInfo
            Dim allCol As GridColumnDescriptorCollection = New GridColumnDescriptorCollection()
            Dim singlecol As GridColumnDescriptor
            For Each computerItemProperty In assetPropertyType.GetProperties()
                singlecol = New GridColumnDescriptor(computerItemProperty.Name, computerItemProperty.Name, computerItemProperty.Name)
                singlecol.AllowFilter = True
                If singlecol.Name <> "" Then
                End If
   'IMyObject Class:
            For Each computerItemProperty In computerPropertyType.GetProperties()
                singlecol = New GridColumnDescriptor(computerItemProperty.Name, computerItemProperty.Name, computerItemProperty.Name)
                singlecol.AllowFilter = True
'Enable Filtering
            GGC.TableDescriptor.Columns = allCol
        End Sub

After intialization, next steps were to get the data and bind them to datasource:

' MyObjectCollection inherits only Ilist(of MyObject)
Dim myObjects as MyObjectCollection = GetObjectCollection()
GGC.Datasource = myObjects

--> This fails, as when binding occurs the debugger runs into the dataset - cast -exception as some data are null. The businesObject itself, declared in an Interface, handles this by returning string.empty or nothing. I have no idea why the binding-process runs down to the dataset.

Then I simply used the collection and built a new list:

Dim myObjects as MyObjectCollection = GetObjectCollection()
Dim myDataSource = list(of MyObject) = new List(of MyObject)
For each mysimpleObject as MyObject in MyObjectCollection

GGC.Datasource = myDatasource

This works, EXCEPT! That there are data which are not shown.

The Class MyObject inherits from a BaseClass (e.g. field "id"), and these items are not shown in the grid.
Class MyObject
Inherits BaseClass
MyName as string
MyDate as Date
All direct fields (MyName,MyDate) are shown correctly, the derived fields are not shown at all; the columns itself are appearing, the cellvalues are missing.

Perhaps I could solve it when I get the key to setup the datasource for the collection. Can someone provide me an example?



Mr. Sascha Wald
Replied On May 24, 2012 02:23 PM UTC

I found the reason. Which is, btw, not reasonable!

The Class "MyObject" should encapsulate the access to the dataset, but there was a public property DataRow of Type DataSetRow.

Changing this property to "Private", and the grid collects the data with no error and shows the inherited elements also.

I guess the Syncfusion-Grid tries something in reflection and runs there into the dataset when the property is public, and if private it uses the object-declaration...

So, now I can setup the Datasource to "MyObjectCollection" and everything works fine...


Asarudheen S [Syncfusion]
Replied On May 29, 2012 09:24 AM UTC

Hi Sascha,

Thank you for your interest in Syncfusion products.

We are glad to know that issue got resolved. Please let us know if you need any further assistance.

Thank you for using Syncfusion products.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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