Skip to content

Binding to objects #16205

Closed
Closed
@dlr1

Description

@dlr1

Will the Bind syntax allow us to bind to objects instead of just primitive types. It throws an error
"Error: System.ArgumentException: 'bind' does not accept values of type WebApplication1.Pages.Customer. To read and write this value type, wrap it in a property of type string with suitable getters and setters."
Here is my code

 <select class="form-control" bind="SelectedCustomer">
        @foreach(var item in Customers)
        {
            <option value="@item">@item.Name</option>
        }
    </select>

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions