Quantcast
Channel: User Simon_Weaver - Stack Overflow
Viewing all articles
Browse latest Browse all 145

Answer by Simon_Weaver for Blazor onclick event is not triggered

$
0
0

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.


Viewing all articles
Browse latest Browse all 145

Latest Images

Trending Articles



Latest Images

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