c# - AllowHtml Could Not Be Found -




i using mvc 5 , allowhtml attribute not being found when use in view model. please tell me doing wrong because have searched internet , seems though doing right.

the error

edit: added code

using system; using system.collections.generic; using system.linq; using system.threading.tasks; using system.componentmodel.dataannotations; using system.web.mvc;  namespace studentgovernment_v2.models.bill {     public class billtexteditmodel     {         public int id { get; set; }         public string name { get; set; }         [allowhtml]         public string text { get; set; }     } } 

make sure you've referenced proper version of system.web.mvc namespace in web.config use allowhtmlattribute. since image shows red squiggly line below namespace, check if web.config files (in project root folder & views folder) has reference depending on mvc version used (i used mvc version 5.0 example here):

[project root]\web.config

<system.web>     <pages validaterequest="true" ...>             <namespaces>            <add namespace="system.web.mvc" />            ...         </namespaces>     </pages> </system.web> ... <runtime>     <dependentassembly>         <assemblyidentity name="system.web.mvc" publickeytoken="31bf3856ad364e35" />         <bindingredirect oldversion="0.0.0.0-5.0.0.0" newversion="5.0.0.0" />     </dependentassembly> </runtime> 

[project root]\views\web.config

<system.web>    <pages ...>    <controls>      <add assembly="system.web.mvc, version=5.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" namespace="system.web.mvc" tagprefix="mvc" />    </controls> </pages> 

then, check references => system.web.mvc , see "version" part in properties window. version number shown on must match version number in web.config:

system.web.mvc namespace

afterwards, try cleaning & rebuilding project, see if red line below allowhtmlattribute vanishes.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -