Razor 在Html.DisplayNameFor中转换为小写

Razor 在Html.DisplayNameFor中转换为小写,razor,asp.net-mvc-5,Razor,Asp.net Mvc 5,这应该很容易,但我看不到。。。 我有以下资料: @Html.EditorFor(model => model.FullName, new { htmlAttributes = new { @class = "form-control",

这应该很容易,但我看不到。。。 我有以下资料:

@Html.EditorFor(model => model.FullName, new
                        {
                            htmlAttributes = new
                            {
                                @class = "form-control",
                                placeholder = "Please type your " + Html.DisplayNameFor( model => model.FullName),
                                data_bind = "value: product.fullname"
                            }
                        })
当我键入
Html.DisplayNameFor(model=>model.FullName.ToLower())
时,我得到一个异常

中发生“System.InvalidOperationException”类型的异常 System.Web.Mvc.dll,但未在用户代码中处理

其他信息:模板只能与字段访问一起使用, 属性访问、一维数组索引或单个参数 自定义索引器表达式

如何在
Html.DisplayNameFor
中操作我的字符串?

DisplayFor()
扩展方法返回一个
MvcHtmlString
,因此您可以使用
ToString()
将返回值转换为字符串,然后使用
ToLower()


很高兴它帮助了你:)
placeholder = "Please type your "
    + Html.DisplayNameFor(model => model.FullName).ToString().ToLower()