Compiler error with mixed content in onclick attribute #5605
Labels
affected-very-few
This issue impacts very few customers
area-blazor
Includes: Blazor, Razor Components
bug
This issue describes a behavior which is not expected - a bug.
feature-razor.language
✔️ Resolution: Duplicate
Resolved as a duplicate of another issue
reevaluate
We need to reevaluate the issue and make a decision about it
severity-minor
This label is used by an internal tool
Status: Resolved
Milestone
I have a line in Teachers.cshtml:
<button onclick="window.location.href = '/teacher/@(teacher.Id)/';">More info...</button>
After compilation I have the following line in Teachers.g.cs (/obj/Debug/netstandart2.0/Pages/):
builder.AddAttribute(24, "onclick", (Microsoft.AspNetCore.Blazor.Components.BindMethods.GetEventHandlerValue<Microsoft.AspNetCore.Blazor.UIMouseEventArgs>() + "window.location.href" + " =" + " \'/teacher/" + (teacher.Id) + "/\';" + ()));
And an error message:
The text was updated successfully, but these errors were encountered: