Button showing password.
I want to add button that shows password. How can I do that? This is my code:
9 Replies
Is this Blazor?
Looks like it.
I don't know what blasor is. This is in cshtml file.
The simple answer is to toggle between displaying
encryptedPassword
and Model.Password
. It's simple enough to add a bool
which is toggled on button click.This is my idea, but I don't know how to toggle after pressing the button.
You're not updating
isPasswordShown
to its negated value. You have to assign the result of that negation.
I'd start with that.This code doesn't work. So what should it look like?
How to assign a value to a variable on button click in razor pages (or cshtml if you're not sure on tech).I don't deal with razor/blazor enough to know for sure without researching it myself.
if this is razor, it won't do anything, since razor isn't reactive