How to use the DataSourceRequest as a parameter in a WebAPI GET method?

4 posts, 0 answers
  1. Oscar
    Oscar avatar
    1 posts
    Member since:
    Oct 2012

    Posted 26 Oct 2012 Link to this post


    After reading the MVC AJAX binding sample code:

    I considered using the DataSourceRequestAttribute and DataSourceRequest in a WebAPI Get method. The signature would look like this:

    public DataSourceResult Get([DataSourceRequestAttribute] DataSourceRequest request)

    I configured the Grid to make the AJAX request as a Get. However it doesn't work. After some research I found out ModelBinders in WebAPI have to implement the System.Web.Http.ModelBinding.IModelBinder, while MVC requires implementing the System.Web.Mvc.IModelBinder interface instead.

    Everything works fine, but that's not very REST-compliant. I rather call the Get method from the grid and pass all parameters in the query string.

    This question is for Telerik: Do you have something in place (or planning to implement) similar to "ApiDataSourceRequestAttribute" that returns a ModelBinder based on System.Web.Http.ModelBinding.IModelBinder to bind the Get query string parameters to a DataSourceRequest?


  2. leblanc
    leblanc avatar
    56 posts
    Member since:
    Aug 2010

    Posted 08 Jan 2014 Link to this post

    Just ran into the same problem - now that web api 2 is out was migrating from mvc to web api.

    they have the modelbinder here: -

    details here:

  3. Mani
    Mani avatar
    1 posts
    Member since:
    Aug 2015

    Posted 06 Aug 2015 Link to this post

    I configured one of the solution but it shows "WebApiDataSourceRequestModelBinder" reference could not found...But i used Kendo.mvc reference..I don't know what to do next.Please give some suggestions
  4. Rosen
    Rosen avatar
    3215 posts

    Posted 12 Aug 2015 Link to this post

    Hello Mani,

    You should verify that you are using at least Q1 2014 version of UI for ASP.NET MVC and ASP.NET MVC 4 or 5. Information on how to bind Grid widget to WebApi controller can be found in this help article. Also a runnable sample is available in the sample application which is accompanying the UI for ASP.NET MVC distribution

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top