Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC4 [AllowHtml] DataAnnotation not being recognized?

I have an existing class in an MVC4 project (also using EF 4) that I need to set the [AllowHtml] DataAnnotation on. I already have annotations on several of the properties in this class (i.e. Required, Display) that are working fine. The appropriate libraries are included:

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

Still, I am getting an error message:

Cannot resolve symbol [AllowHtml]

Here is the code. The first two annotations are working. The third is not. I tried setting it separately from the others, that made no difference. What am I missing?

[Display(Name = "Title"), Required, AllowHtml]
public string Title { get; set; }
like image 759
Todd Davis Avatar asked Dec 08 '22 14:12

Todd Davis


1 Answers

AllowHtml is in the System.Web.Mvc namespace

http://msdn.microsoft.com/en-us/library/system.web.mvc.allowhtmlattribute(v=vs.98).aspx

like image 55
cadrell0 Avatar answered Jan 07 '23 18:01

cadrell0