AllowHtml attribute not working

后端 未结 4 741
粉色の甜心
粉色の甜心 2020-12-06 07:38

I have a model with this property:

     [AllowHtml]
     [DisplayName(\"Widget for Table\")]
     [StringLength(1000, ErrorMessage = \"Maximum chars 1000\")]         


        
4条回答
  •  一整个雨季
    2020-12-06 08:06

    I had the same problem. My model class is named "GeneralContent" and has the property "Content". In my action method i used attribute like this:

    public ActionResult Update(GeneralContent content)

    when i renamed content argument to cnt, everything works well. I think MVC is confused when some attribude of model class has the same name as the argument in action method.

提交回复
热议问题