Html.Raw is null

s3rqan

New Member
I'm in trouble here. In my view i have the following code:\[code\]@if (!string.IsNullOrEmpty(alert)) { <div class="alert">@Html.Raw(alert)</div>}\[/code\]But an exception of type NullReferenceException is being thrown saying that the Html property is null. How i can solve this?OBS: My view page inherits from a class that by their turn inherits from System.Web.WebPages.WebPage// WEBCONFIG\[code\]<system.web><compilation debug="true" targetFramework="4.0"> <assemblies> <add assembly="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Web.WebPages.Deployment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </assemblies></compilation><httpRuntime targetFramework="4.0"/>\[/code\]
 
Back
Top