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

Problem on kendogrid datasource and wcf service

0 Answers 162 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roel Hans Bethlehem
Top achievements
Rank 1
Roel Hans Bethlehem asked on 29 Dec 2011, 04:27 PM
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:
                $.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

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Roel Hans Bethlehem
Top achievements
Rank 1
Share this question
or