MultiSelect
Complex Type
This sample shows how to bind to a list of complex type using "display-member-path" , "selected-value-path" and "checked-member-path" attributes.
Features
Description
This sample shows how to bind to a list of complex type using "display-member-path" , "selected-value-path" and "checked-member-path" attributes.
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 | using Microsoft.AspNetCore.Mvc; using MvcExplorer.Models; namespace MvcExplorer.Controllers { public partial class MultiSelectController : Controller { private C1NWindEntities _db; public MultiSelectController(C1NWindEntities db) { _db = db; } public ActionResult ComplexType() { return View(_db); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | @model C1NWindEntities < div > < label > @Html .Raw(MultiSelectRes.ComplexType_Text0)</ label > < c1-multi-select header-path = "ProductName" display-member-path = "ProductName" selected-value-path = "ProductID" checked-member-path = "Discontinued" > < c1-items-source source-collection = "Model.Products" /> </ c1-multi-select > </ div > @section Description{ < p > @Html .Raw(MultiSelectRes.ComplexType_Text1)</ p > < p > @Html .Raw(MultiSelectRes.ComplexType_Text2)</ p > } |