I am learning ASP.NET Core, the ways to display the Model properties on a View...
So, I discovered the DisplayAttribute.ShortName
property that
Gets or sets a value that is used for the grid column label.
More than that
The short name is used as the grid column label for a UI element that is bound to the property that is annotated with this attribute. The Dynamic Data
Insert.aspx
andEdit.aspx
page templates use the ShortName for the field label.
What should MS mean by "grid column label"?
I used that in my view, but obtained the Name
instead of the ShortName
<table>
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Date) <!--Creation Date-->
</th>
<th>
@Html.DisplayNameFor(model => model.Name) <!--Project Name-->
</th>
<th></th>
</tr>
</thead>
for the defined Model like this
[Display(Name = "Creation Date", ShortName = "Date")]
public DateTime Date { get { return this.Timestamp.DateTime; } }
[Display(Name = "Project Name", ShortName = "Name")]
public string Name { get; set; }
Custom Helper
I already saw a very helpful answer on how to build a custom helper that could use it do the custom @Html.DisplayShortNameFor()
, but I wonder what for it was created, if no possibility to use it without creating additional and, mainly, same shared by the community custom helpers, that, probably, should be included in the framework?! Am I missing something?
What are the "grid column label" and Insert.aspx
and Edit.aspx
templates (for the "asp.net core" usage)?