-
Notifications
You must be signed in to change notification settings - Fork 10k
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
DisplayNameFor support in Blazor #49147
Comments
An attribute using a Resource key could be also useful to localize it. |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Side-note on my hitting this, too, while performing doc updates. I was also going to cover it this way ... [Required, DisplayName("Production Date")]
public DateTime ProductionDate { get; set; } Both decorations ( I'm going to place some guidance on those approaches, but I'll comment it out so that it won't appear right now and leave a tracking note in place to keep an 👁️ on the issue. I can confirm that the <InputDate @bind-Value="Model!.ProductionDate" DisplayName="Production Date" /> |
I find it strange that decorating class members with attributes and using those attributes in code (so central and useful in Razor pages) has been abasically dropped for Blazor. I would suggest this should be pushed forward if possible. |
It doesnt look like it will make it it in .Net9 since its not in the planning doc, hoping for .Net 10...... |
Noting that there are related open issues (and a closed PR) on this subject ...
@danroth27 ... I hit this again for the new tutorial. I think subclassing |
MVC & Razor Pages have the DisplayNameFor HTML helper. Blazor doesn't currently have any helpers for creating a display name for model properties or expressions. This would be useful for scaffolding form field labels based on a model type, where you pick up the display name from attributes, like
[Display(Name="Release date")]
, on the model. QuickGrid has some logic for displaying column headings based on a model type, but it doesn't support theDisplayAttribute
.The text was updated successfully, but these errors were encountered: