Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow Html Attribute Not Found [AllowHtml]

Can anyone tell me what I need to include besides System.ComponentModel.DataAnnotations to get [AllowHtml] to be recognized? When I add the attribute to a property it tells me the following compiler error:

"The type or namespace name 'AllowHtml' could not be found (are you missing a using directive or an assembly reference?)"

I need to allow html to my field and cannot continue until I get this working. Any help would be greatly appreciated!

Thanks...

like image 628
clockwiseq Avatar asked Mar 28 '11 05:03

clockwiseq


2 Answers

As far as I can tell, [AllowHtml] belongs to the System.Web.Mvc namespace. http://msdn.microsoft.com/en-us/library/system.web.mvc.allowhtmlattribute(v=vs.98).aspx

like image 180
Sasha Goldshtein Avatar answered Nov 09 '22 14:11

Sasha Goldshtein


I had this same issue and took me a while to realise that I was referencing system.web.mvc v2 not v4, so make sure you check the version.

FYI, I had my models stored in a separate project

like image 23
osouthgate Avatar answered Nov 09 '22 14:11

osouthgate