Blazor OnClick doesn’t fire

Posted by

#notetoself … Once again, scratching my head for way to long about something that turns out to have a simple workaround #devlife

On one of my (new) blazor pages (/Bookings/TeeTimes), onclick event was not firing. Didn’t matter what kind of flavour of onclick declaration I used, the event was not getting fired.

Until of course I noticed that this page was producing a lot of blazor loading errors:

Turns out I was running the project (as usual) from command line (dotnet) and had a shortcut in my browser to go directly to this page. Seems like that sets the “document root” to “Bookings” and from that it tries to find the blazor files.

Starting from the root page and navigating to the Bookings/TeeTimes page solved the problem, with the permanent fix being adding this within the head element of the layout

<base href="/" />

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s