View _ViewImports.cshtml
@addTagHelper *, TagHelperSuite |
View Index.cshtml
<form asp-page-handler="Post"> | |
<link-button>Test Link</link-button> | |
</form> |
View Default.aspx
<asp:LinkButton ID="lbtnSubmit" runat="server" PostBackUrl="~/About.aspx" Text="Submit Form" /> |
View Index.cshtml
<form method="post"> | |
<button asp-page="/Index" asp-page-handler="Post">Submit Form</button> | |
</form> |
View Index.cshtml.cs
public class IndexModel : PageModel | |
{ | |
public void OnGet() | |
{ | |
} | |
public void OnPost() | |
{ | |
} | |
} |
View CardTagHelper.cs
// Fetch the context, so that we can add the Card object to the Cards collection | |
var handContext = (HandContext)context.Items[typeof(HandTagHelper)]; | |
handContext.Cards.Add(new Card { Rank = rank, Suit = suit }); |
View HandContext.cs
public class HandContext | |
{ | |
public List<Card> Cards { get; set; } = new List<Card>(); | |
} |
View _Card.cshtml
@model TagHelpersDemo.Views.Shared.Partials.CardViewModel | |
<img src="images/@(Model.PlayerName).png" alt="avatar" class="center-block" /> | |
<div class="text-center"> | |
<h2 class="@Model.SuitColorClass"> | |
<strong>@Html.Raw(Model.SuitCharacterCode)</strong> | |
</h2> | |
<p>@Model.Rank</p> | |
</div> |
View CardTagHelper.cs
var content = await _html.PartialAsync("~/Views/Shared/Partials/_Card.cshtml", model); | |
output.Content.SetHtmlContent(content); |
NewerOlder