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

Send filter to server using MVC

4 Answers 372 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Philip Senechal
Top achievements
Rank 1
Philip Senechal asked on 09 Aug 2012, 10:43 PM
Hello,
I'm using the MVC method for my AutoComplete. I'm able to connect to the data source and bring back a list, however, I would like to send what the user is typing to the action in order to filter on the server instead of bringing back all 4000 results and filtering on the client. I cannot seem to figure out either how to add it to the request, or to pick it up in the controller. My helper looks like this:
@(Html.Kendo().AutoCompleteFor(x => x.Distribution)
                    .DataTextField("label")
                    .DataSource(source => {
                        source.Read(read => {
                            read.Url("/EmployeeSearch");
                        });
                        source.ServerFiltering(true);
                    })
                    .Filter("contains")
                    .Suggest(true)
                    .MinLength(3)
                    .Separator("; ")
                )

I can see from the post that filter[filters][0][value]textbeingtyped
is sent in the request, but I can't figure out how to pick that up in the Controller.

Thanks for any help you can provide.

4 Answers, 1 is accepted

Sort by
0
Philip Senechal
Top achievements
Rank 1
answered on 09 Aug 2012, 10:56 PM
I think I got it. I used an example from the Combobox and it seems to have worked.
0
Sameera
Top achievements
Rank 1
answered on 01 Sep 2012, 11:33 AM
I am having the same issue. Can you please post the solution?

Thanks.
0
Robert
Top achievements
Rank 1
answered on 05 Sep 2012, 06:39 PM
I have not been able to make method signature work in the MVC controller method, but this works for me to retrieve the value from the autocomplete control

string searchValue = Request.Params["filter[filters][0][value]"];

0
Jon
Top achievements
Rank 1
answered on 19 Nov 2012, 05:08 PM
Looks like you can set these values in the datasource to force pull from the server:

serverFiltering: true,
serverPaging: true,

I found this in the ComboBox example:
http://docs.kendoui.com/getting-started/web/combobox/overview
Tags
AutoComplete
Asked by
Philip Senechal
Top achievements
Rank 1
Answers by
Philip Senechal
Top achievements
Rank 1
Sameera
Top achievements
Rank 1
Robert
Top achievements
Rank 1
Jon
Top achievements
Rank 1
Share this question
or