RadzenSwitch ValueChanged and Value

Hi there, I'm trying to use the ValueChanged event of a RadzenSwitch to add or remove a role from a user (in AspNetUserRoles, in fact). This works on its own, but if I set the Value property to reflect the initial state of whether a user has a role or not, the switch becomes read-only. How do I make it read-write in this case?

The @bind syntax would work, but is sort of inconvenient here because, by itself, toggling the role state requires an additional action to update the database. I was hoping to make the switch itself do the database update.

You can try using the Change event instead of ValueChanged and still use @bind-Value.

1 Like