Filtering not working because of interface
Hello,
when I filter a grid column it filters it okay but I get the following exception Error: System.NotSupportedException: Deserialization of interface types is not supported. Type 'ISomeInterface'
SIGN IN To post a reply.
4 Replies
1 reply marked as answer
VN
Vignesh Natarajan
Syncfusion Team
September 18, 2020 06:38 AM UTC
Hi Ivan,
Thanks for contacting Syncfusion support.
Query: “but I get the following exception Error: System.NotSupportedException: Deserialization of interface types is not supported. Type 'ISomeInterface'”
We understand that you are facing exception error while filtering a column in Grid. We need some more details to validate the reported issue further at our end. So kindly share the following details.
- Share your Grid code example.
- Share details about your datasource along with its type.
- Are you facing issue during the initial filter or filter the column for second time.
- Share the screenshot of the error along with its stack trace.
- If possible share the issue reproducible sample to validate the reported query at our end.
Above requested details will be helpful for us to validate the reported query at our end and provide solution as early as possible
Regards,
Vignesh Natarajan
KI
Krasimir Ivanov
September 18, 2020 08:29 AM UTC
This happens when the data source is a IEnumerable of some interface. After the grid is rendered I try to filter a column for the first time, select equal to and write a string to filter by. Then I get the exception.
KI
Krasimir Ivanov
September 18, 2020 08:37 AM UTC
Here is the stack trace:

VN
Vignesh Natarajan
Syncfusion Team
September 21, 2020 12:16 PM UTC
Thanks for sharing the details.
From your query we understand that you are facing issue while binding the datasource in form of IEnumerable of some interface. We do not have support for direct interface binding support, as model type is required for various operations like column field mapping, validation and model instance creation during editing/adding. So we suggest you to bind the data by using a specific model type which inherits the interface.
For your convenience we have prepared a sample using interface and specific model to bind data to Grid and perform Data Operation. Refer the below code example.
|
@inject IOrderService OrderService
<SfGrid DataSource="@Orders" AllowFiltering="true" AllowPaging="true" Height="315">
<GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu"></GridFilterSettings>
. . . . . .
</SfGrid>
@code{
public IEnumerable<Order> Orders { get; set; }
protected override async Task OnInitializedAsync()
{
Orders = await OrderService.GetEmployees();
}
}
|
Kindly download the sample from below
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan
Marked as answer
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
- Marked answer
-
KI Krasimir Ivanov
- Sep 17, 2020 11:09 PM UTC
- Sep 21, 2020 12:16 PM UTC