ASP.NET MVC Editors AutoComplete Data Binding Server Binding - Telerik UI for ASP.NET MVC
New to Telerik UI for ASP.NET MVCStart a free 30-day trial

Server Binding

Local data is the data that is available on the client when the AutoComplete is initialized.

You can bind the AutoComplete locally on the server by passing the appropriate collection to the HTML helper BindTo() method.

  1. Pass the data to the view through ViewData.

    Razor
         public ActionResult Index()
         {
             ViewData["products"] = GetProducts();
    
             return View(new ProductViewModel
             {
                 ProductID = 4,
                 ProductName = "ProductName4"
             });
         }
    
         private static IEnumerable<ProductViewModel> GetProducts()
         {
             var products = Enumerable.Range(0, 2000).Select(i => new ProductViewModel
             {
                 ProductID = i,
                 ProductName = "ProductName" + i
             });
    
             return products;
         }
  2. Add the AutoComplete to the view and bind it to the data that is saved in ViewData.

    Razor
        @model MvcApplication1.Models.ProductViewModel
    
        @(Html.Kendo().AutoCompleteFor(m => m.ProductName)
            .DataTextField("ProductName")
            .BindTo((System.Collections.IEnumerable)ViewData["products"])
        )

See Also

In this article
See Also
Not finding the help you need?
Contact Support