I need to get the first initial of the first name
I have the following:
@Html.DisplayFor(modelItem => item.FirstName.Substring(1,1))
I get the following error though when the program tries to run it:
Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.
You can’t do this, because the mapping to your abject wont work like this. Like the exception message tells you you can only use it with properties.
You can however write your own HtmlHelper extension to do what you want