MultiSelect
Complex Type
Features
Sample
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.
Source
ComplexTypeController.cs
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); } } }
ComplexType.cshtml
@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> }
Documentation