Hi,
I had quite some trouble to get the grid to bind to json data returned by a WCF service hosted on IIS 7. The following works for me:
Now I would like to use the datasource property in the kendogrid rather than using the ajax success callback. Is there any way to achieve this?
Kind regards,
Roel Hans
I had quite some trouble to get the grid to bind to json data returned by a WCF service hosted on IIS 7. The following works for me:
$.ajax({
dataType: 'json',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: '{}',
url: 'api/dsl',
success: function (data) {
$("#grid").kendoGrid({
dataSource: {
data: data,
pageSize: 10
},
height: 750,
groupable: true,
scrollable: true,
sortable: true,
filterable: true,
pageable: true,
autobind: true
});
},
error: function (jqXHR, textStatus, errorThrown) {
alert("error: " + textStatus + ": " + jqXHR.responseText);
}
});
It seems i need to specify contenttype and data in order to have jquery play nice with IIS 7 (this post helped me: http://encosia.com/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax/). It all started to work for me then when I set those properties on the ajax call.Now I would like to use the datasource property in the kendogrid rather than using the ajax success callback. Is there any way to achieve this?
Kind regards,
Roel Hans