parent
4a813773d0
commit
ed4896d1fd
|
|
@ -75,7 +75,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata
|
||||||
displayMetadata.Description = () => displayAttribute.GetDescription();
|
displayMetadata.Description = () => displayAttribute.GetDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisplayFormat
|
// DisplayFormatString
|
||||||
if (displayFormatAttribute != null)
|
if (displayFormatAttribute != null)
|
||||||
{
|
{
|
||||||
displayMetadata.DisplayFormatString = displayFormatAttribute.DataFormatString;
|
displayMetadata.DisplayFormatString = displayFormatAttribute.DataFormatString;
|
||||||
|
|
@ -87,6 +87,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata
|
||||||
displayMetadata.DisplayName = () => displayAttribute.GetName();
|
displayMetadata.DisplayName = () => displayAttribute.GetName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EditFormatString
|
||||||
if (displayFormatAttribute != null && displayFormatAttribute.ApplyFormatInEditMode)
|
if (displayFormatAttribute != null && displayFormatAttribute.ApplyFormatInEditMode)
|
||||||
{
|
{
|
||||||
displayMetadata.EditFormatString = displayFormatAttribute.DataFormatString;
|
displayMetadata.EditFormatString = displayFormatAttribute.DataFormatString;
|
||||||
|
|
@ -233,8 +234,9 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata
|
||||||
var display = field.GetCustomAttribute<DisplayAttribute>(inherit: false);
|
var display = field.GetCustomAttribute<DisplayAttribute>(inherit: false);
|
||||||
if (display != null)
|
if (display != null)
|
||||||
{
|
{
|
||||||
|
// Note [Display(Name = "")] is allowed.
|
||||||
var name = display.GetName();
|
var name = display.GetName();
|
||||||
if (!string.IsNullOrEmpty(name))
|
if (name != null)
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -424,7 +424,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata
|
||||||
typeof(EnumWithDisplayNames),
|
typeof(EnumWithDisplayNames),
|
||||||
new List<KeyValuePair<string, string>>
|
new List<KeyValuePair<string, string>>
|
||||||
{
|
{
|
||||||
new KeyValuePair<string, string>("cero", "0"),
|
new KeyValuePair<string, string>(string.Empty, "0"),
|
||||||
new KeyValuePair<string, string>(nameof(EnumWithDisplayNames.One), "1"),
|
new KeyValuePair<string, string>(nameof(EnumWithDisplayNames.One), "1"),
|
||||||
new KeyValuePair<string, string>("dos", "2"),
|
new KeyValuePair<string, string>("dos", "2"),
|
||||||
new KeyValuePair<string, string>("tres", "3"),
|
new KeyValuePair<string, string>("tres", "3"),
|
||||||
|
|
@ -436,7 +436,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata
|
||||||
typeof(EnumWithDisplayNames?),
|
typeof(EnumWithDisplayNames?),
|
||||||
new List<KeyValuePair<string, string>>
|
new List<KeyValuePair<string, string>>
|
||||||
{
|
{
|
||||||
new KeyValuePair<string, string>("cero", "0"),
|
new KeyValuePair<string, string>(string.Empty, "0"),
|
||||||
new KeyValuePair<string, string>(nameof(EnumWithDisplayNames.One), "1"),
|
new KeyValuePair<string, string>(nameof(EnumWithDisplayNames.One), "1"),
|
||||||
new KeyValuePair<string, string>("dos", "2"),
|
new KeyValuePair<string, string>("dos", "2"),
|
||||||
new KeyValuePair<string, string>("tres", "3"),
|
new KeyValuePair<string, string>("tres", "3"),
|
||||||
|
|
@ -708,7 +708,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata
|
||||||
[Display(ShortName = "uno")]
|
[Display(ShortName = "uno")]
|
||||||
One = 1,
|
One = 1,
|
||||||
|
|
||||||
[Display(Name = "cero")]
|
[Display(Name = "")]
|
||||||
Zero = 0,
|
Zero = 0,
|
||||||
|
|
||||||
[Display(Name = "menos uno")]
|
[Display(Name = "menos uno")]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue