Questions tagged [asp.net-core-tag-helpers]
ASP.NET Core MVC TagHelpers are server-sided classes used for rendering HTML content. They react to specific HTML tags or attributes within Razor views, and can alter and generate new markup. They're a modern alternative to the ASP.NET MVC Html Helpers.
asp.net-core-tag-helpers
373
questions
1
vote
1
answer
38
views
How to pass a Guid to a property on a Tag Helper in ASP.NET Core
I have a custom TagHelper I need to pass a Guid to, but I get errors when I pass the value.
How can I pass in a Guid?
TagHelper:
[HtmlTargetElement("assets:signin", Attributes = "...
0
votes
1
answer
45
views
Optionally invoke tag helpers in Razor page
This select will be populated normally:
<select ... [email protected] asp-items=Model.Products>
</select>
Sometimes I want to render it as empty; I tried:
<select ... @if (!...
0
votes
0
answers
29
views
Display a formatted date of CurrentUICulture in EditorFor()
So I've been trying to "convert" a property of type DateTime to a formatted localized string to then display in a date input field.
My model's property:
[Display(Name = "StartingDate&...
0
votes
0
answers
35
views
Custom tag helper automatically removes attributes from markup
Consider a custom tag helper with this:
[HtmlTargetElement("a", Attributes = "custom")]
public class CustomTagHelper : TagHelper
{
[HtmlAttributeName("foo")]
public ...
0
votes
0
answers
41
views
Use Intellisense for ASP.NET Core areas, controllers and actions in Custom View Components
I guess everyone is familiar with the ASP.NET Core taghelpers like form where you can use the attributes like asp-area to get intellisense for the areas, controllers or actions. I would like the same ...
1
vote
1
answer
81
views
Tag helpers in ASP.NET Core 8 MVC
The ASP.NET Core MVC tag helpers aren't acting like they used to. When I write something like this:
<a asp-area="Admin" asp-controller="Home" asp-action="Index"><...
1
vote
1
answer
84
views
Asp.net Core Razor Pages - Custom TagHelpers & Boiler plate CRUD code
I'm sure this problem has been faced many times before.
I have a lot of CRUD forms, so I have a lot of repeated boiler plate code.
e.g.
<div class="form-group">
<label asp-for=&...
0
votes
1
answer
40
views
custom TagHelper is not being rendered [duplicate]
I want to port a very old pdf processing application to .Net and in the process convert handelbars templates to Razor.
I am scratching my head on why a TagHelper is not being picked up.
namespace ...
0
votes
1
answer
32
views
Replicate asp-for functionality on any element
ASP.NET Core's <input> and <label> tag helpers support the asp-for property, which generates id, name and for appropriately.
Is it possible to get those values somehow and use them on some ...
0
votes
1
answer
37
views
how to get the html for a tag helper in code
I have some tag helpers I need to "render" in code, meaning I'm looking to get the html that would be used in a view.
How can I get a HTML string representation of a tag helper?
Here's just ...
1
vote
2
answers
53
views
TagHelpers Not Functioning in New Area
I created a new area on a project to separate concerns. However, I just ran into a strange issue where the taghelpers aren't working correctly, not even constructing the correct URL at all.
The ...
0
votes
0
answers
72
views
Sitecore Experience Editor Links Not Editable
When trying to edit items in Sitecore experience editor, editing links does not work. When I click on them i select the parent item instead of the link itself. If I click a second time it follows the ...
0
votes
2
answers
113
views
Button with type reset not working for ASP.NET Core select tag helper
I have a form with a button with type "reset". But after clicking it, it doesn't reset the select tag helper items. How can I solve it in the practical and easiest way?
I'm using ASP.NET ...
0
votes
0
answers
57
views
I wrote a taghelper class and then i add it to my _viewImport . but it isn't known in my layout
I wrote this tagHelper class
//[HtmlTargetElement("MenuItem")]
public class MenuItemTagHelper : TagHelper
{
private readonly IGetMenuItemService getMenuItemService;
public ...
0
votes
1
answer
60
views
How to convert TaghelperContent to TagBuilder?
How to convert TaghelperContent to TagBuilder?
For example, i have below taghelper:
[HtmlTargetElement("custom-tag")]
public class CustomTag: TagHelper
{
public async override Task ...