Skip to content

[Blazor] Ability to add a callback on the default onchange when Using @bind #21892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mrlife opened this issue May 15, 2020 · 1 comment
Closed
Labels
✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved

Comments

@mrlife
Copy link
Contributor

mrlife commented May 15, 2020

Is your feature request related to a problem? Please describe.

When working with Entity Framework Core in Blazor, it would be convenient to be able to bind to a tracked property so that when the element representing the property is changed, the change can be saved via Entity Framework Core as well.

Describe the solution you'd like

<input type="checkbox" id="checkboxIsFavorite" @bind="User.IsFavorite" @onchange-callback="SaveContext">

@code {
    [Parameter]
    public Record User { get; set; } // this is already being tracked by EF Core

    // this function is called after the default onchange completes
    private async Task SaveContext() {
        // code that simply saves the db context, which will save the change to User.IsFavorite
    }
}
@mkArtakMSFT
Copy link
Contributor

Thanks for contacting us. This is currently not supported, but we plan to add support for this as part of #14365

@mkArtakMSFT mkArtakMSFT added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label May 16, 2020
@ghost ghost added the Status: Resolved label May 16, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jun 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Projects
None yet
Development

No branches or pull requests

2 participants