Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor - @onchange is not a valid attribute but onchange works

$
0
0

Something weird is happening with my ASP.NET MVC project. I started implementing some razor components for a section of the page that has a lot of UI change with user clicks.

This is a snippet inside my _ScopeTabPartial.razor, it is in folder /Views/Request/_ScopeTabPartial.razor:

<div class="s6 switch-installation horizontal"><label class="switch"><input type="checkbox" id="new-install-switch" checked="@SharedState.ScopeTabViewModel.IsNewInstallation" @onchange="@(UpdateIsNewInstallationState)"><span class="padding">New installation @SharedState.ScopeTabViewModel.IsNewInstallation</span> @* @bind="@SharedState.ScopeTabViewModel.IsNewInstallation"*@</label></div>

It does not work, Google Chrome says:

enter image description here

But when I use:

<div class="s6 switch-installation horizontal"><label class="switch"><input type="checkbox" id="new-install-switch" checked="@SharedState.ScopeTabViewModel.IsNewInstallation" @onchange="@(UpdateIsNewInstallationState)"><span class="padding">New installation @SharedState.ScopeTabViewModel.IsNewInstallation</span> </label></div>

it works!

Now, my issue is that I wanted to use

@bind="@SharedState.ScopeTabViewModel.IsNewInstallation"

and bind= is not behaving as supposed. Any help?

I only found this : https://github.com/dotnet/aspnetcore/issues/20980


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>