Questions tagged [displayattribute]

DisplayAttribute is a type of .NET Attribute that can be applied to types and classes to provide localized strings or formats

26 questions
1
vote
3 answers

Display attribute in MVC doesnt display cyrillic in the HTML

I try to render cyrillic word "име" instead of the name of the column(FirstName) in the table from the DataBase but instead i receive some strange symbols "Èìå". I have a in my webconfig and also I've checked…
Georgi93
  • 47
  • 1
  • 8
1
vote
1 answer

Can't get value from resources file using reflection

I have two .resx files for localization - Global.en.resx and Global.resx(ru). Trying to get the value by name using ResourceManager I face a problem: the value displays only on Russian. ResourceManager rm = new ResourceManager(resourceType.FullName,…
1
vote
2 answers

Range Attribute for Dates

I have this class overriding the RangeAttribute: public class RangeDateAttribute : RangeAttribute { public RangeDateAttribute() : base(typeof(DateTime), DateTime.Now.AddYears(-20).ToShortDateString(),…
developer033
  • 24,267
  • 8
  • 82
  • 108
1
vote
0 answers

Using DisplayAttributes with a series of radio buttons for one variable

I'm writing an MVC application, and I have a view for editing users, which contains a series of possible user roles. Each user has exactly one role, so I'm using radio buttons for the "UserRole" property, each of which gives it a different…
1
vote
1 answer

Multiple MVC3 Display attributes

I have a property in a model. Lets say for an Email. Public Property Email As String I want to use a different label for the email in every page so basically I'm asking if there is a way to use…
ZiGiUs
  • 394
  • 4
  • 15
0
votes
2 answers

Using DisplayAttribute of column in a Controller

I have defined [Display(Name = "From Date")] for columns in a Model and I am using it from a View with the help of tag helpers like asp-for and @Html.DisplayNameFor(). But I am exporting data to an Excel sheet, and that code is in a controller. Now…
0
votes
1 answer

ASP.net-Core: How to use different [display name] value for each instance?

I have two classes that similar in every thing but member display names are different. My solution was creating two classes, but this is not compliant with coding standards. Is there another way to solve that? I expect that supporting multiple…
0
votes
1 answer

MVC 5 Display attribute issue

Enum Class public enum DataReleaseChoice { Accept, Decline, [Display(Name = "Retrieve your application")] Continue } In my view:
Sekhar
  • 5,614
  • 9
  • 38
  • 44
0
votes
1 answer

Telnet display attributes issue

I try to implement a Telnet client, I can understand simple rule like: (ESC)[41m => set background color to red (ESC)[32;41m => set background color to red, font color to green but I'm confused for something, like…
PatrickSCLin
  • 1,419
  • 3
  • 17
  • 45
0
votes
2 answers

Localize DisplayNameAttributes in ActionFilter?

Is it possible to access the DisplayNameAttributes that are used on my ViewData.Model so I can Localize them before sending them to the view? Something like this: Public Void OnActionExecuted(ActionExecutedContext: filterContext) { foreach…
0
votes
1 answer

ASP.NET MVC DataType.Text

Having the following view model in my ASP.NET MVC 3 application, I have a problem described below: public class MyViewModel : ViewModelBase { // having this line kills the one below it, while commenting it out solves the problem. WHY? …
1
2