Trying to bind model with (data)relations to grid

Hi

I am trying to bind a “complex” object to the grid. The model, an order viewmodel, is having relation to a CustomerViewModel which have a property for the customers name. (See the model in the attached file).

When I’m trying to bind the customers name using nameof(OrderViewModel.Customer.Name) the grid throws an exception, a null reference exception.

It seems like the internal PropertyInfoHelper are not able to traverse the objects, more than one level. See attached stacktrace in the bugreport folder for details.

I have created a small example with the model I am trying to use, and also recorded a small sample of the issue.

Is it possible to replace the PropertyInfohelper with a custom PropertyInfoHelper or is there any other way to get around this problem?

best regards patrik
Attachment: SyncfusionDemo.Grid.ComplexObject_64e88a55.zip

1 Reply 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team January 11, 2021 08:53 AM UTC

  
Hi Patrik, 

Greetings from Syncfusion support. 

We suggest you to refer to the below documentation for binding complex field columns in Grid. 

Please refer and use as like the codes below, 

 
<GridColumn Field="Customer.Name" HeaderText="Customer name" Visible="true" /> 

 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Marked as answer
Loader.
Up arrow icon