Skip to content

Support creating Tag Helpers using CSHTML files #4990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DamianEdwards opened this issue Aug 19, 2016 · 8 comments
Closed

Support creating Tag Helpers using CSHTML files #4990

DamianEdwards opened this issue Aug 19, 2016 · 8 comments
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-razor-pages
Milestone

Comments

@DamianEdwards
Copy link
Member

Just an initial idea:

RepeatTagHelper.cshtml

@tagHelper "repeat"

@class {
    [HtmlAttributeName("repeat")]
    public int Repeat { get; set; }
}

@{
    output.TagName = null;
}

@for (var i = 0; i < Repeat; i++) {
    @await output.GetChildContentAsync(useCachedValue: false)
}
@pranavkm
Copy link
Contributor

public int Repeat { get; set; }?

@DamianEdwards
Copy link
Member Author

Doh, typo

@hishamco
Copy link
Member

This is a very cool one, perhaps it's very handy if we support it too in the "Razor Pages", because it's kind of Razor Helpers that we know and love

@DamianEdwards
Copy link
Member Author

Yep, this would of course work with the pages stuff too.

@hishamco
Copy link
Member

Can we use @functions instead of @Class because the block already allow us to declare properties

@brockallen
Copy link

brockallen commented Aug 20, 2016

It's too thin of a veneer, IMO. So for people that know tag helpers, why not just code in C#. For those that don't already know how tag helpers work, there's too much magic here.

@82dsoldier
Copy link

Wouldn't that essentially be the same functionality as a ViewComponent?

@rynowak
Copy link
Member

rynowak commented Apr 10, 2017

Moving to the backlog, this is not planned for 2.0.0-preview1.

@aspnet-hello aspnet-hello transferred this issue from aspnet/Razor Dec 14, 2018
@aspnet-hello aspnet-hello added this to the Backlog milestone Dec 14, 2018
@aspnet-hello aspnet-hello added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-razor-pages labels Dec 14, 2018
@pranavkm pranavkm added the c label Aug 20, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-razor-pages
Projects
None yet
Development

No branches or pull requests

8 participants