Milan
Milan

Reputation: 1019

Blazor: Access other object properties in bind:set and bind:after

I was curious to see new .net 7 Blazor binding syntax in action and tried to replace @onchange="@(code => OnCodeChanged(code, r.ServiceId))" with bind:after but I couldn't find a way to pass it ServiceId which I need to properly identify entity which is being updated.

Is there a way to pass arbitrary parameters to bind:after or bind:set?

Upvotes: 0

Views: 142

Answers (1)

MrC aka Shaun Curtis
MrC aka Shaun Curtis

Reputation: 30036

You can do:

@bind-value:set="(value) => this.OnChange(value, 1)"

but you can't do the same with @bind-value:after because of the way it's implemented.

See this answer to a recent question which goes into a little more detail and the current issues with the bind setup in Net7.0 - https://stackoverflow.com/a/75277308/13065781.

Upvotes: 1

Related Questions