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

Using WCF to provide data to Grid

1 Answer 170 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris Whisker
Top achievements
Rank 1
Chris Whisker asked on 26 Jul 2012, 01:34 PM
Hi, 

I am attempting to create a grid that uses a WCF service as the datasource it is bound to. This has started well... I am able to pass back the data and have incorporated paging & sorting.

I am now looking at incorporating the Grouping and Filtering features, however this is proving problematic.

What I would like to do is pass the 'DataSourceRequest' directly to WCF as it contains all the arguments regarding the sorting, filtering & grouping in it

e.g. 
public ActionResult Index([DataSourceRequest(Prefix = "Grid")] DataSourceRequest request)
        {
            if (request.PageSize == 0)
            {
                request.PageSize = 10;
            }
 
            MvcApplication3.psr.ProductServiceClient psrc = new MvcApplication3.psr.ProductServiceClient();
 
             ResultData results = psrc.KendoGridQuery(DataSourceRequest);
 
            ViewData["total"] = results.Count;
          
             return View(results.Data);
         
        }

I then tried to add the Kendo.MVC library to my WCF project as a reference library so that I would be able to use the DataSourceRequest type.... However when I add the Kendo.MVC.dll as a reference and then compile the project it is unable to import the Kendo namespace.

I assume this is because the wrapper will only work within a MVC project?

Is it possible to add the data types from the MVC wrapper to my WCF project?

Thanks

Chris

1 Answer, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 26 Jul 2012, 02:10 PM
Hi Chris, 

Kendo.Mvc.dll is indeed intended to be used in ASP.NET MVC applications. If you want to refer it from your WCF project you also need to refer to all assemblies that Kendo.Mvc.dll depends on. Those assemblies are:
  • Microsoft.CSharp
  • System.ComponentModel.DataAnnotations
  • System.Configuration
  • System.Core
  • System.Data
  • System.Data.DataSetExtensions
  • System.Drawing
  • System.Runtime.Serialization
  • System.Web
  • System.Web.Abstractions
  • System.Web.Extensions
  • System.Web.Mvc
  • System.Web.Razor
  • System.Web.Routing
  • System.Web.WebPages
  • System.Web.WebPages.Deployment
  • System.Web.WebPages.Razor
  • System.Xml

Also your code currently may not compile because you are using the type DataSourceRequest instead of the request parameter:

old:

ResultData results = psrc.KendoGridQuery(DataSourceRequest); 

new:

ResultData results = psrc.KendoGridQuery(request); 


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