haacked / feedback

Ask @haacked anything!
7 stars 1 forks source link

It seems that found a bug in mvc.. #223

Closed 1stetcgoldmedal closed 2 years ago

1stetcgoldmedal commented 2 years ago

code @Html.ActionLink("TextFFF", "tech", "section") result <a href="/section/tech">TextFFF</a> code @Html.ActionLink("Text", "tech", "section", new { @class = string.Concat("nav-link", ViewContext.RouteData.Values["Action"].ToString() == "Index" ? " active" : "") })

result <a class="nav-link active" href="/home/tech?Length=2">Text</a>

Obviously it should return the same controller and action. But it's returning something else. It seems that it is because string.concat is used when applying css class. is this a bug right? Should I write another solution to apply "bootstrap navbar active" class?