Does your project include ASP.NET Core MVC?
Warning: Do not put Blazor .razor
components in /Views
So the component I was having issues with was originally a .cshtml
page under MVC.
\Views\Email\EmailPreview.razor // originally .cshtml
My <select>
with @bind
worked just fine, my [Parameter]
declarations worked (i.e. it was definitely running as Blazor), but when I added the simplest possible@onclick
it didn't work.
Renaming it to EmailPreview2.razor
didn't work, and even copying the logic from the Counter.razor
sample file didn't work.
Eventually wondered if it had anything to do with the location being /Views
and sure enough when I moved it to /Components
it worked just fine. I'm thinking it's some kind of conflict with MVC that is generating a partial class that is conflicting.
Would love a better explanation if anyone knows this to be correct.