Blazor two way query parameter binding
How can i bind it two way? for example i open page with
category=foo
, then navigate on the site to category foo
and it change query parameter value to bar
?2 Replies
I don't know that you're looking for is two-way binding, and it would be more difficult with query parameters. Here's regular two-way binding:
Normal two-way binding happens in Blazor by creating a
{Parameter}Changed
parameter. For example:
---
What you're doing now should already be binding as you want. Navigation to ?Category=bar
will update your Category
property's value to bar
. To react to that reassignment, override OnParametersSet
.This is regular parameter, i want url query parameter