Display String Value to UpperCase

Rhett Herring 96 Reputation points
2021-07-08T21:10:00.817+00:00

Working on ..net core 5 web site.

Model field
public string Rating { get; set; }

HTML display:
@azzedinehtmlsql .DisplayFor(modelItem => item.Rating)

I need to show the value to the user in uppercase only.

I have tried : @azzedinehtmlsql .DisplayFor(modelItem => item.Rating.ToUpper())

Which throughs an error "InvalidOperationException: Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions".

Is there an annotation I can use on the model?

How can I show the value as uppercase? Ideally not use css.

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
696 questions
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful