dotnet / dotnet/aspnetcore

InputTagHelper respect name override from `IModelNameProvider.Name` in ModelExpression

Open
#40,182 3 comments 0 reactions 0 assignees View on GitHub
area-mvc enhancement
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

Let's imagen the following page model:

```cs
public class IndexModel : PageModel
{
[BindProperty(SupportsGet = true, Name = "public_name")]
public string? InternalUsedParameterName { get; set; }

public async Task OnGetAsync()
{ }

public async Task OnPostAsync()
{ }
}
```

```cshtml
@page "/"
@model IndexModel

```

### Describe the solution you'd like

While rendering the `InputTagHelper` should respect the name set by the `IModelNameProvider.Name` property and set the id and name html attributes accordingly.

### Additional context

_No response_

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.