This is a migrated thread and some comments may be shown as answers.

PUT encoded as x-www-form-urlencoded

1 Answer 454 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rwb
Top achievements
Rank 2
rwb asked on 20 Jan 2016, 01:31 PM

I'm trying to get the grid working with a .NET MVC OData endpoint.

 I've found that the grid always encodes the data as application/x-www-form-urlencoded but in the request gives the content type as application/json and therefore .NET fails to deserialise.

 

Is there any way to get the grid to encode as json (a work-around is to set transport.update.contentType = 'application/x-www-form-urlencoded; charset=UTF-8'). 

 

It seems very odd that everyone is expecting (and asking for) json but the grid refuses to produce anything other than x-www-form-urlencoded.

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 25 Jan 2016, 08:33 AM

Hello rwb,

 

Indeed, as mentioned here, by default the request parameters will be posted using the jQuery's conventions. In order to customize this you will need to use the parameterMap in order to convert the values in the appropriate format. 

 

As a side note. You may find a runnable sample which demonstrates how to implement CRUD operations using OData endpoints via ASP.NET Web API in this GitHub repository. Another sample which you may find helpful is this one which demonstrate the integration withOData v4.

 

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
rwb
Top achievements
Rank 2
Answers by
Rosen
Telerik team
Share this question
or