Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Edited Issue: DisplayName attribute from Resources? [306]

$
0
0
Based on sample below, this code is not working very well:
<h2>@Html.DisplayNameFor(model => model.Profile)</h2>

ENTITY MODEL

public class Profile
{
[Column(TypeName = "UNIQUEIDENTIFIER")]
[DataType(DataType.Text, ErrorMessageResourceName = "DataTypeText", ErrorMessageResourceType = typeof(Resources.Models.ErrorMessages))]
[Display(Name = "Id", ResourceType = typeof(Resources.Models.Entities.Profile))]
[Key]
[RegularExpression(@"[0-9a-f]{8}\-([0-9a-f]{4}\-){3}[0-9a-f]{12}", ErrorMessageResourceName = "RegularExpression", ErrorMessageResourceType = typeof(Resources.Models.ErrorMessages))]
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(Resources.Models.ErrorMessages))]
public Guid Id { get; set; }
}

VIEW MODEL

public class ProfileDetails
{
[Display(Name = "Profile", ResourceType = typeof(Resources.Models.Views.ProfileDetails))]
public Profile Profile;
}

HOWEVER, with this writing style, you can change the display name for model.

[DisplayName("SAMPLE TITLE")]
public class Profile
{
...
}

Solution provided at this link is working, but I think it has very simple solution to merge DisplayNameAttribute to DisplayAttribute or something like that.

http://stackoverflow.com/questions/356464/localization-of-displaynameattribute

THANKS FOR ALL OF YOUR EFFORTS.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>