We want to be able to filter the data for the AutoComplete widget on the server side. We can either use the data
property within the transport
JavaScript object, or we can continue with our MVC example and specify the data to send inside the DataSource
lambda expression. Let's say, for example, that we want to be able to choose what type of states and territories show up in the AutoComplete widget. We can accomplish this by sending some data along with the request, then having the server revise the data that it sends back. Replace the contents of AutoCompletePage.cshtml
with this updated code.
<h2>AutoCompletePage</h2> <label for="stateType">Choose whether to see States:</label> <select id="stateType" name="stateType"> <option value="true">Show States</option> <option value="false">Show Only Territories</option> </select> <br /> @(Html.Kendo().AutoComplete() .Name("statesAndTerritories") ...