ComboBox Databind with OData not working after upgrade to .net core 6

I am struggling to get our ComboBoxes working after an upgrade to asp.net core 6. Below is our implementation that has been working until the upgrade.


<ejs-combobox id="LocationId" allowFiltering="true" showClearButton="false" allowCustom="false" enabled="false"autofill="true" ignoreCase="true" change="locationChange" filterType="Contains" query="new ej.data.Query().select(['Name','Id'])">
<e-combobox-fields text="Name" value="Id"></e-combobox-fields>
<e-data-manager url="/SalesOrders/GetLocationsQuery" adaptor="ODataV4Adaptor" crossDomain="false">
</e-data-manager>
</ejs-combobox>


Controller:

[HttpGet]
[EnableQuery]
public IEnumerable GetLocationsQuery()
{
return _context.Locations;
}


I get the following error when I attempt to query the data:

{"Message":"The query specified in the URI is not valid. The property 'Name' cannot be used in the $filter query option.","ExceptionMessage":"The property 'Name' cannot be used in the $filter query option.","ExceptionType":"Microsoft.OData.ODataException","StackTrace":"   at Microsoft.AspNetCore.OData.Query.Validator.FilterQueryValidator.ValidateSingleValuePropertyAccessNode(SingleValuePropertyAccessNode propertyAccessNode, ODataValidationSettings settings)\r   at Microsoft.AspNetCore.OData.Query.Validator.FilterQueryValidator.ValidateSingleValueFunctionCallNode(SingleValueFunctionCallNode node, ODataValidationSettings settings)\r   at Microsoft.AspNetCore.OData.Query.Validator.FilterQueryValidator.ValidateSingleValueFunctionCallNode(SingleValueFunctionCallNode node, ODataValidationSettings settings)\r   at Microsoft.AspNetCore.OData.Query.Validator.ODataQueryValidator.Validate(ODataQueryOptions options, ODataValidationSettings validationSettings)\r   at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.ValidateQuery(HttpRequest request, ODataQueryOptions queryOptions)\r   at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.OnActionExecuting(ActionExecutingContext actionExecutingContext)"}

Any help to get this back up and running would be appreciated.


1 Reply 1 reply marked as answer

SP Sureshkumar P Syncfusion Team August 25, 2022 11:28 AM UTC

Hi Logan,

We have validated your reported issue from our end with the net6.0 application. But we cannot replicate the reported issue on our end. we have attached the validated sample in the attachment. We suspect that the query property is the reason for the reported script error. So we suggest you check the query property value to resolve the issue from your application.

Find the code example here:

<ejs-combobox id="LocationId" allowFiltering="true" showClearButton="false" allowCustom="false" enabled="true" autofill="true" ignoreCase="true" change="locationChange" filterType="Contains" query="new ej.data.Query().select(['CustomerID', 'OrderID'])">

    <e-combobox-fields value="CustomerID"></e-combobox-fields>

    <e-data-manager url="https://services.odata.org/V4/Northwind/Northwind.svc/Orders/" adaptor="ODataV4Adaptor" crossdomain="true">

    </e-data-manager>

</ejs-combobox>

 

<script>

    function locationChange(){

 

    }

</script>

If still, you have faced the same issue, then please replicate the reported issue on the attached sample and revert us with detailed issue replication steps. These details will help us to provide an exact solution as earlier as possible.

Note: If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.

Regards,

Sureshkumar P


Attachment: ASPCore_5a8ccb10.zip

Marked as answer
Loader.
Up arrow icon