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

DataSourceRequest model binding not working

1 Answer 545 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Einar
Top achievements
Rank 1
Einar asked on 28 May 2015, 10:15 PM

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

 

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 01 Jun 2015, 11:28 AM

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
Tags
AutoComplete
Asked by
Einar
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or