dotnet / dotnet/aspnetcore

Make SelectTagHelper more extensible

Open
#7,409 6 comments 5 reactions 0 assignees View on GitHub
affected-few area-mvc enhancement feature-mvc-razor-views severity-minor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

Is it possible to extend the SelectTagHelper to allow more customisation of the generated options? The idea being that I want to provide a little more metadata about options which in turn changes the dynamics of the UI.

public class ExtendedSelectListItem : SelectListItem
{
public HtmlAttribute[] Attributes { get; set; }
}

// if something exists
public class HtmlAttribute
{
public string Name { get; set; }
public string Value { get; set; }
}

I essentially want something like:

None
Contains
DoesNotContain
Between
NotBetween

I've looked at the internals of ExtendedSelectTagHelper but that then uses an instance of IHtmlGenerator (DefaultHtmlGenerator) which goes down to the depths of GenerateSelect and internals of GenerateOption.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.