tag-helpers Questions

4

Solved

In asp.net mvc you can use: @Html.DropDownListFor(model => model.Category, ViewBag.Category as IEnumerable<SelectListItem>, "-- SELECT --", new { @class = "form-control" }) Using asp.ne...
Chase asked 18/1, 2016 at 1:4

2

Solved

I am creating a custom HTML Tag Helper: public class CustomTagHelper : TagHelper { [HtmlAttributeName("asp-for")] public ModelExpression DataModel { get; set; } public override async Task Pro...
Amorete asked 5/11, 2016 at 12:6

2

Solved

I have written a tag helper that I can use as follows... <mytaghelper attr1="jim"></mytaghelper> I would like to be able to shorten this to just... <mytaghelper attr1="jim"> ...
Langan asked 14/5, 2019 at 13:40

1

According to this article if we use several tag helpers(targeted to the same tag) and in each of them we will use await output.GetChildContentAsync() to recieve html content we will come to the pro...
Chau asked 11/7, 2016 at 15:2

7

I am generating scripts in process method of TagHelper class as follows [TargetElement("MyTag")] public Class MYClass: TagHelper{ public override void Process(TagHelperContext context, TagHelper...
Philippines asked 9/7, 2015 at 9:31

2

Solved

The ASP.NET Core TagHelper documentation gives the following example: public class WebsiteContext { public Version Version { get; set; } public int CopyrightYear { get; set; } public bool Appro...
Buckler asked 21/9, 2015 at 10:25

1

Solved

I am new to ASP.NET Core. I just discovered TagHelpers and as I may get the idea, theoretically we should be able to replace partial views with tag helpers. Beyond that, TagHelper can accept input...
Retinoscope asked 11/11, 2018 at 15:36

4

In an ASP.NET Core View I have the following: <div class="message" message=""></div> And I the a Tag Helper with the following TagHelper: [HtmlTargetElement("div", Attributes = Mess...
Alvord asked 26/10, 2016 at 17:23

1

I have a for loop to generate fields on a form. How can I set the value of asp-for based on the current index? <label asp-for=@("Value" + i) class="control-label"></label> does not ...

4

I want to enable or disable a textarea depending on a condition that evalueates from the model, and I am using the textarea tag helper. In other words, something like this: <textarea asp-for="D...
Garrett asked 19/1, 2016 at 0:27

1

Solved

I would like to trigger the stock ScriptTagHelper (view source on GitHub) so that it would emulate the asp-append-version="true" attribute. I know that the proper way to use this is to ju...

3

Solved

I recently ran into a situation where I would like to use a tag helper within a tag helper. I looked around and couldn't find anyone else trying to do this, am I using a poor convention or am I mis...
Trottier asked 2/2, 2017 at 19:10

2

Solved

What would I give to asp-for property of a label tag helper in order to display items from a collection. The code below generates a compilation error. @foreach (var item in Model) { <label asp...
Prohibition asked 9/8, 2015 at 11:58

2

In this official ASP.NET Core tutorial, I can use an Input Tag Helper as shown below. But due to a known model binding issue of form elements in a foreach loop, I want to use for loop instead. Ques...
Freshen asked 11/9, 2016 at 22:40

3

Solved

Some of model properties has "Required" data annotation, that I need to read in a TagHelper class. public partial class Sale { [Required] public string CustomerId { get; set; } ... In the sal...
Heaume asked 9/11, 2016 at 12:18

1

I'm in the process of getting to grips with ASPNET CORE [version 1.1, using VS2017 Community, version 15.1 (26403.3)]I've created a working ViewComponent called UserDetails (abbreviated below): na...
Juniejunieta asked 5/5, 2017 at 8:23

6

Solved

Is there supposed to be Intellisense for the new asp- tag helpers in Razor/MVC 6? I was following along on one of Shawn Wildermuth's courses on Pluralsight and everything functions properly, but I ...
Diaeresis asked 4/12, 2015 at 22:28

2

Solved

If I have a view model like this: public class MyModel{ public DateTime? StartDate {get;set;} } And on a view an input tag is used with an asp-for tag helper like so: <input asp-for="Star...
Mady asked 11/4, 2017 at 22:10

1

Solved

Tag Helper's are one of the sweet features of Asp.Net Core. I have created several tag helpers and they can be super helpful. Now I would like to try something a bit more advanced. Tag helper attr...
Mcintyre asked 7/4, 2017 at 19:17

3

Solved

Is it possible in ASP.Net Core to automatically convert camel case property names in view models to insert spaces into the corresponding labels when using tag helpers? If my view model looks like ...

1

Solved

I created a tag helper that inherits from InputTagHelper as shown by an answer in this post https://mcmap.net/q/1146081/-input-tag-helper-not-working-with-razor-code. Here is the code [HtmlTarge...
Occlusion asked 2/3, 2017 at 0:53

1

Solved

I'm litle confused with behaviour of TagHelper intoduced in ASP.NET Core MVC. Following this tutorial A working email Tag Helper we have opportunity to write self-closing tags. According to the art...
Monotheism asked 11/7, 2016 at 10:51

1

Solved

How to get elements defined as TagHelper content? E.g. element defined as: <markdown>bla bla</markdown> And helper defined as: [HtmlTargetElement("markdown")] public class Markdown...
Grannia asked 28/11, 2016 at 17:28

4

Solved

I am having trouble getting Tag Helpers enabled in my project. Here is a summary of the project setup: VS 2015 RC Community Edition. Project.json reference: Microsoft.AspNet.Mvc": "6.0.0-beta4 _...
Equites asked 21/6, 2015 at 14:11

1

Solved

I am incorporating TagHelpers in my MVC vNext project, and I realized they don't work when I self close the HTML tags. @addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers" <label asp-for="FirstN...
Amato asked 14/9, 2016 at 9:16

© 2022 - 2024 — McMap. All rights reserved.