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

DataManager with WCF-RESTful Example

Thread ID:





116212 Apr 25,2014 03:18 AM UTC Apr 29,2014 05:07 PM UTC JavaScript 2
Tags: ejDataManager
Asked On April 25, 2014 03:18 AM UTC

Can I have an example about how-to use DataManager consume WCF-RESTful with and without parameter?

Madhu Sudhanan P [Syncfusion]
Replied On April 28, 2014 12:57 PM UTC

Hi Simla,


Currently we are working in your requirement and we will update you the response on April 29, 2014.


Please let us know if you have any queries.



Madhu Sudhanan. P

Madhu Sudhanan P [Syncfusion]
Replied On April 29, 2014 05:07 PM UTC

Hi Simla,


Thanks for using Syncfusion products.


Based on your request, we have created a simple Grid sample which is loaded with the data from the WCF RESTful service using DataManager and the same can be downloaded from the following location.


Sample Location: OrderService.zip


In the above sample, we have created two Grids and a WCF RESTful service with two method “GetDataWithParam” and “GetDataWithOutParam”.  Those methods are implemented from the interface IOrder.


The method GetDataWithOutParam will be invoked when the URI is as defined in the UriTemplate as follow.



[WebGet(UriTemplate = "Orders",ResponseFormat = WebMessageFormat.Json)] //Call the method without parameter

string GetDataWithOutParam();


The method GetDataWithParam will be invoked when a request is made without parameter.



[WebInvoke(Method = "POST", UriTemplate = "Orders", RequestFormat = WebMessageFormat.Json,

ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] //Call the method with parameter

string GetDataWithParam(int take,int skip);




To request the web service without parameter using DataManager, please refer the following code snippet. In the below code snippet , request will be made to the web service using executeQuery method.



var data1 = ej.DataManager({ url: "/Order.svc/Orders" });

        var query = new ej.Query();

        var dm = data1.executeQuery(query); //Request the webservice

        dm.done(function (e) {


                dataSource: e.result





To request the WCF service with parameter, please refer the following code snippet. we have used the ej.Query() to add parameters and configured the DataManager using the UrlAdaptor and hence POST request will be send to the WCF RESTful Service with parameter skip and take.



var data2 = ej.DataManager({ url: "/Order.svc/Orders" });

        data2.adaptor = new ej.UrlAdaptor();

        var query1 = new ej.Query().skip(5).take(30); //Adding parameter to be send to the webservice

        var dm1 = data2.executeQuery(query1) //Request the webservice




                dataSource: e.result



Now the request will made to the webservice with parameter value skip as 5 and take as 30.



For getting started with WCF OData service please refer the following link.




Please let us know if you have any queries.



Madhu Sudhanan. P


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