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

OData V4 not found with key string

Thread ID:





128208 Jan 8,2017 04:29 PM UTC Aug 14,2018 09:00 AM UTC ASP.NET MVC 11
Tags: DataManager
Emanuele Filardo
Asked On January 8, 2017 04:29 PM UTC

I'm using string as primarykey but OData V4 adaptor call method with http://url/ODataService/Entity(key) instead of ('key').

How can I change it or use another OData Url Key Delimiter (ex. http://url/ODataService/Entity/key)?


Prince Oliver [Syncfusion]
Replied On January 9, 2017 11:49 AM UTC

Hi Emanuele,   
Thanks for contacting Syncfusion Support.   
We were unable to understand your query. Please explain your scenario where you need to use primary key as string and share additional details with sample or screenshot.   
If you are looking to change the odata query string based on your service URL, you can use querying to alter the URL.   
Refer to the following JS UG link for more information:   
JS Playground sample demonstrating Odata v4:   
MVC sample link:   

Emanuele Filardo
Replied On January 9, 2017 12:19 PM UTC

I'll try to explain better.
I'm using RESTier as OData backend and there aren't problem to fetch the list of entities and the url is https://myappurl/api/ODataService/Customers;
When I update an entity, the DataManager use this url https://myappurl/api/ODataService/Customers(keyvalue) and receive Not Found, because it expect this url https://myappurl/api/ODataService/Customers('keyvalue') or https://myappurl/api/ODataService/Customer/keyvalue

I need to add apostrophe inside parentheses or use slashes, is possible?

Prince Oliver [Syncfusion]
Replied On January 10, 2017 02:26 PM UTC

Hi Emanuele, 

Thanks for your update. 

In order to modify the query string based on your requirement. You can use custom adaptor in datamanager to extend OData adaptor and modify the convertToQueryString method. Have a look at the following code snippet. 

<script type="text/javascript"> 
     $(function () { 
          var dataManager = ej.DataManager({ url: "http://services.odata.org/V4/Northwind/Northwind.svc/", crossDomain: true, adaptor: new customAdaptor() }); 
          var query = new ej.Query().from("Orders").select("OrderID", "CustomerID", "EmployeeID").take(5); 
          var promise = dataManager.executeQuery(query); 
          promise.done(function (e) { 
              $("#table1 tbody").html($("#tableTemplate").render(e.result.value)); 
         // extending ODataAdaptor as custom adaptor to alter query creation based on our requirement 
          var customAdaptor = new ej.ODataAdaptor().extend({ 
                             convertToQueryString: function (req, query, dm) { 
                                    var res = [], tableName = req.table || ""; 
                                    delete req.table; 
                                    if (dm.dataSource.requiresFormat) 
                                           req["$format"] = "json"; 
                                    for (var prop in req) 
                                           res.push(prop + "=" + req[prop]); 
                                    res = res.join("&"); 
                                    if (dm.dataSource.url && dm.dataSource.url.indexOf("?") !== -1 && !tableName) 
                                           return res; 
                                    return res.length ? tableName + "/?" + res : tableName || "";// add "/" or enclose the query string in '' single quotes 

We have attached a sample for your convenience, refer to the following link for the sample: 


Emanuele Filardo
Replied On January 11, 2017 05:17 PM UTC

Is possible to create customAdaptor with c# instead of js?

Prince Oliver [Syncfusion]
Replied On January 12, 2017 09:15 AM UTC

Hi Emanuele, 

Thank you for contacting Syncfusion support. 

Currently we cannot create custom adaptor in C# to modify the query string as per your requirement. 

Refer to the following KB link for server side Datamanager operations: https://www.syncfusion.com/kb/4300/server-side-api-for-datamanager-operations 

Refer to the following UG link for MVC Datamanager: https://help.syncfusion.com/aspnetmvc/datamanager/data-adaptors 


Alberto Barrera
Replied On March 23, 2018 02:26 AM UTC

Any solution to set ('string') not (int)?

Ilakkiya Baskar [Syncfusion]
Replied On March 23, 2018 10:51 AM UTC

Hi Emanuele, 
Sorry for the inconvenience . 
We have validated your scenario and confirmed “key as string” as a defect. We will fix this issue and include in our upcoming Volume 1 SP1 ,2018 release which will be rolled out by the end of this month. 

Borja Fernández
Replied On August 8, 2018 05:15 PM UTC


I'm having the same issue in Asp.Net core, is there any solution?

Borja Fernández.

Karthikeyan Viswanathan [Syncfusion]
Replied On August 9, 2018 05:01 PM UTC

Hi Borja, 
The “key as string” issue fix is available from 2018 volume 2 release. So, we are suggested to use the latest version of ASP.Net Core. 

Still, If you have an issue related to “key”. Please share the below details: 

  1. Share the code snippet which it is help to reproduce this issue.
  2. Share the issue reproducing sample if possible.
  3. Share the screenshot of this issue if any error occur.
  4. Share the product version details.
Karthikeyan V. 

Borja Fernández
Replied On August 10, 2018 03:37 PM UTC

Sorry, forget to say I was using ej2. 

Best regards

Karthikeyan Viswanathan [Syncfusion]
Replied On August 14, 2018 09:00 AM UTC

Hi Borja,  
We have checked and confirmed “With string value as primary key ‘not found’ error thrown in OdataV4Adaptor update Request” as a defect. This fix will be included in any of our upcoming patch releases.  
Until then we appreciate your patience.  
Karthikeyan V. 


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