Send filter to server using MVC

5 posts, 0 answers
  1. Philip Senechal
    Philip Senechal avatar
    152 posts
    Member since:
    Apr 2008

    Posted 09 Aug 2012 Link to this post

    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.
  2. Philip Senechal
    Philip Senechal avatar
    152 posts
    Member since:
    Apr 2008

    Posted 09 Aug 2012 Link to this post

    I think I got it. I used an example from the Combobox and it seems to have worked.
  3. Kendo UI is VS 2017 Ready
  4. Sameera
    Sameera avatar
    1 posts
    Member since:
    Sep 2012

    Posted 01 Sep 2012 Link to this post

    I am having the same issue. Can you please post the solution?

    Thanks.
  5. Robert
    Robert avatar
    7 posts
    Member since:
    Jul 2012

    Posted 05 Sep 2012 Link to this post

    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]"];

  6. Jon
    Jon avatar
    4 posts
    Member since:
    May 2011

    Posted 19 Nov 2012 Link to this post

    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
Back to Top
Kendo UI is VS 2017 Ready