asp.net-core-tag-helpers

How do ASP.NET Core's “asp-fallback-*” CDN tag helpers work?

折月煮酒 提交于 2019-11-29 09:21:46
I understand what the asp-fallback-* tag helpers do. What I don't understand is how. For example: <link rel="stylesheet" href="//ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/css/bootstrap.min.css" asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css" asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" /> This loads bootstrap from the CDN, and loads the local copy if the CDN is down. But how does it decide to do that? I assume it checks asp-fallback-test-class , asp-fallback-test-property , and asp-fallback-test-value . But what do

Input Tag Helper Not Working with Razor Code

无人久伴 提交于 2019-11-29 06:49:43
I want to combine an input tag helper with razor code to set an attribute but I cannot get the two technologies to work together. I am simply trying to set the disabled attribute on the input field based on the value of view model property. When i put the razor code after the asp-for tag the razor intellisense is not recognized and the field is not disabled as expected... <input asp-for="OtherDrugs" @((Model.OtherDrugs == null) ? "disabled" : "") class="form-control" /> Rendered output... <input type="text" id="OtherDrugs" name="OtherDrugs" value="" /> When i put the razor code before the asp

Append QueryString to href in asp.net core Anchor Helper Tag

烈酒焚心 提交于 2019-11-28 07:32:17
问题 I am trying to add anything in the query of the request to anchors in the html result: Fictitious example: User makes a request (note that band and song could be anything, I have a route catering this request: template: "{band}/{song}"): http://mydomain/band/song?Param1=111&Param2=222 Now I want my anchors to append the query string part to the href of my anchors. So I tried something like this (note the 'asp-all-route-data'): <a asp-controller="topic" asp-action="topic" asp-route-band="iron