Server Binding
You can configure the Telerik UI MultiSelect for server binding to the Northwind Products table which uses Linq to SQL.
-
Create a new action method and pass the Products table as the model.
public ActionResult Index() { NorthwindDataContext northwind = new NorthwindDataContext(); return View(northwind.Products); }
-
Make your view strongly typed.
@model IEnumerable<MvcApplication1.Models.Product>
-
Add a server bound MultiSelect.
@model IEnumerable<ProjectName.Models.ProductViewModel> @(Html.Kendo().MultiSelect() .Name("productDropDownList") // The name of the MultiSelect is mandatory. It specifies the "id" attribute of the widget. .DataTextField("ProductName") // Specify which property of the Product to be used by the MultiSelect as a text. .DataValueField("ProductID") // Specify which property of the Product to be used by the MultiSelect as a value. .BindTo(Model) // Pass the list of Products to the MultiSelect. )
@model IEnumerable<ProjectName.Models.ProductViewModel> <kendo-multiselect name="productDropDownList" datatextfield="ProductName" datavaluefield="ProductID" bind-to="Model"> </kendo-multiselect>