O'Reilly logo

Learning Kendo UI Web Development by John Adams

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using AutoComplete with MVC through Ajax

Open the view and make a change to the AutoComplete() extension method call just like this code block.

<h2>AutoCompletePage</h2>
@(Html.Kendo().AutoComplete()
    .Name("statesAndTerritories")
    .Placeholder("Choose state or territory...")
    .DataTextField("Name")
    .Filter("startswith")
    .DataSource(source =>
        {
source.Read(read =>
            {
read.Action("AutoCompleteData", "Kendo");
            })
            .ServerFiltering(false);
        })
)

We have removed the BindTo(Model)and replaced it with a call to DataSource() where we use a lambda expression to define how to create the data source. In this case, we have configured it to use the action method that returns the JSON data we configured earlier, and also that the server is not performing any filtering. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required