Display String Value to UpperCase

Rhett Herring 96 Reputation points

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.
478 questions
No comments
{count} votes

0 additional answers

Sort by: Most helpful