ASP.NET Core MVC Controls | ComponentOne
Working with Controls / Input Controls / MultiSelect / Work with MultiSelect / MultiSelect Bound to an Array of Objects
In This Topic
    MultiSelect Bound to an Array of Objects
    In This Topic

    The MultiSelect control can be customized to display a list of custom objects in the dropdown. This is accomplished by by binding it with a collection of objects using DisplayMemberPath, SelectedValuePath, and CheckedMemberPath properties.
    The following image shows a MultiSelect control bound to a collection of Products from a local NorthWind database file C1NWind.mdf.


    The following code examples demonstrate how to bind a Multi-select control to a collection of objects:

    In Code

    ComplexTypeController.cs

    C#
    Copy Code
    private C1NWindEntities db = new C1NWindEntities();
    public ActionResult ComplexType()
    {
        return View(db);
    }
    

    ComplexType.cshtml

    HTML
    Copy Code
    @model C1NWindEntities
    
    <div>
        <label>MultiSelect bound to an array of objects:</label>
    
        <c1-multi-select display-member-path="ProductName" selected-value-path="ProductID" checked-member-path="Discontinued">
            <c1-items-source source-collection="Model.Products" />
        </c1-multi-select>
    </div>
    

    Back to Top