MultiSelect
Complex Type
This sample shows how to bind to a list of complex type using "DisplayMemberPath" , "SelectedValuePath" and "CheckedMemberPath" properties.
Features
Description
This sample shows how to bind to a list of complex type using "DisplayMemberPath" , "SelectedValuePath" and "CheckedMemberPath" properties.
Use HeaderPath if you want to decouple the value shown in the header content from the values shown in the drop-down list.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Data.Entity.Validation; using System.Data; using C1.Web.Mvc; using C1.Web.Mvc.Serialization; using MvcExplorer.Models; namespace MvcExplorer.Controllers { public partial class MultiSelectController : Controller { private C1NWindEntities db = new C1NWindEntities(); public ActionResult ComplexType() { return View(db); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | @model C1NWindEntities < div > < label > @Html .Raw(Resources.MultiSelect.ComplexType_Text0)</ label > @ (Html.C1().MultiSelect() .Bind(Model.Products) .Name( "products" ) .HeaderPath( "ProductName" ) .DisplayMemberPath( "ProductName" ) .SelectedValuePath( "ProductID" ) .CheckedMemberPath( "Discontinued" ) ) </ div > @section Description{ < p > @Html .Raw(Resources.MultiSelect.ComplexType_Text1)</ p > < p > @Html .Raw(Resources.MultiSelect.ComplexType_Text2)</ p > } |