Wednesday, January 15, 2020

the Tag Helpers of .NET Core

Here is an example of both asp-for (makes both the Id and Name properties of the HTML tag made from the Razor markup to be: VolumeMonth) and asp-items.

<select asp-for="VolumeMonth" asp-items="@(new
      SelectList(ViewBag.MonthList,"Id","Name"))">
</select>

 
 

This has some notes on using an enum in an asp-items like so:

<select asp-for="RelationshipStatus" asp-items="Html.GetEnumSelectList()">
</select>

No comments:

Post a Comment