DataSourceRequest model binding not working

2 posts, 0 answers
  1. Einar
    Einar avatar
    19 posts
    Member since:
    Jul 2014

    Posted 28 May 2015 Link to this post

    I have the following controller action that is invoked when I type in the Autocomplete box, however the DataSourceRequest object isn't populated with the filters that are passed, as if the model binding isn't working (all of the properties for my request variable below are the defaults i.e. filters is null).

    1.public JsonResult GetParentResellers([DataSourceRequest]DataSourceRequest request)
    2.{
    3.    //...           
    4.}

     

    View:

    1.@(Html.Kendo().AutoComplete()
    2.      .Name("hi")
    3.      .DataSource(ds => ds.Read("GetParentResellers", "Resellers")
    4.            .ServerFiltering(true)))

     

    And finally here's what's sent to the server( query string)

    1.filter[logic]:and
    2.filter[filters][0][value]:f
    3.filter[filters][0][operator]:startswith
    4.filter[filters][0][field]:
    5.filter[filters][0][ignoreCase]:true

     

     

     

     

     

     

  2. Rosen
    Admin
    Rosen avatar
    3237 posts

    Posted 01 Jun 2015 Link to this post

    Hello Einar,

    In order to use the DataSourceRequest and ToDataSourceResult combo you will need to configure the AutoComplete to use custom DataSource configuration as described here. In the setup shown in the code snippet you will need to send the filter text as additional request parameter, which to use inside the controller. This approach is discussed here.

    Regards,
    Rosen
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top