Asp.Net MVC 2 LabelFor Custom Text

后端 未结 4 2047
南旧
南旧 2021-01-01 17:39

Is there a way to use the LabelFor helper and customize the label text without having to use the DisplayNameAttribute in my model?

4条回答
  •  盖世英雄少女心
    2021-01-01 18:17

    Why not just create your own Html Helper?

    public static class MVCHelpers
    {
        public static string CustomLabelFor(this HtmlHelper helper, string ...)
    
        {
            return "

提交回复
热议问题