Friday, 9 August 2013

Using Orchard CMS in VS 2012 and my View cshtml file will not compile

Using Orchard CMS in VS 2012 and my View cshtml file will not compile

I get error indicator lines at @Html.TextBoxFor and
@Html.ValidationMessageFor with msg "System.Web.WebPages.Html.HtmlHelper
does not contain a definition for 'TextBoxFor' and for
'ValidationMessageFor' and no extension method 'TextBoxFor' and for
'ValidationMessagefor' accepting a first argument of type
'System.Web.WebPages.Html.HtmlHelper' could be found..." I have added
using statements directly to the code, confirmed that the references in
Web.config are correct, and I have even tried creating an extension
method. Nothing seems to help. Please advise. I am new to Razor, so
everything is a learning experience.
@model Contact.Settings.Models.ContactSettingsPart
@using System.Web.Mvc.Html
<fieldset>
<legend>@T("Contact Detail")</legend>
<div class="editor-label">
@Html.LabelFor(model => model.ContactFunctionalArea,@T("Contact Name"))
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.ContactFunctionalArea)
@Html.ValidationMessageFor(model => model.ContactFunctionalArea)
</div>
</fieldset>

No comments:

Post a Comment