New to Telerik UI for ASP.NET MVCStart a free 30-day trial

Server Binding

You can configure the Telerik UI DropDownList for server binding to the Northwind Products table which uses Linq to SQL.

  1. Create a new action method and pass the Products table as the model.

    Razor
     public ActionResult Index()
     {
         NorthwindDataContext northwind = new NorthwindDataContext();
    
         return View(northwind.Products);
     }
  2. Make your view strongly typed.

    Razor
     @model IEnumerable<MvcApplication1.Models.Product>
  3. Add a server bound DropDownList.

Razor
     @(Html.Kendo().DropDownList()
     .Name("productDropDownList") // The name of the DropDownList is mandatory. It specifies the "id" attribute of the widget.
     .DataTextField("ProductName") // Specify which property of the Product to be used by the DropDownList as a text.
     .DataValueField("ProductID") // Specify which property of the Product to be used by the DropDownList as a value.
     .BindTo(Model)   // Pass the list of Products to the DropDownList.
     .SelectedIndex(10) // Select an item with index 10. Note that the indexes are zero-based.
     )

See Also

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