Kevin Pratt
unread,May 30, 2010, 10:30:38 AM5/30/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nhaml-users
I was trying out nhaml and was converting one of my views that
contained :
<fieldset>
<legend>Fields</legend>
<div class="editor-label">
<%= Html.LabelFor(model => model.UserName) %>
</div>
<div class="editor-field">
<%= Html.EditorFor(model => model.UserName) %>
<%= Html.ValidationMessageFor(model => model.UserName)
%>
</div>
I converted it to :
%fieldset
%legend Fields
.editor-label
= Html.LabelFor(model => model.UserName)
.editor-field
= Html.EditorFor(model => model.UserName)
= Html.ValidationMessageFor(model => model.UserName)
However I'm getting an error message that looks something like:
c:\Documents and Settings\kpratt\Local Settings\Temp\ecjc94rf.
0.cs(56,43) : error CS1061: 'System.Web.Mvc.HtmlHelper' does not
contain a definition for 'LabelFor' and no extension method 'LabelFor'
accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could
be found (are you missing a using directive or an assembly reference?)
I can't seem to use any of the "For" methods.
My web config looks like:
<section name="nhaml"
type="NHaml.Configuration.NHamlConfigurationSection, NHaml" />
<nhaml autoRecompile="true" templateCompiler="CSharp3"
encodeHtml="true">
<assemblies>
<clear />
<add assembly="System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089" />
</assemblies>
<namespaces>
<clear />
<add namespace="System.Web" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Collections" />
<add namespace="System.Collections.Generic" />
</namespaces>
</nhaml>
If this is a limitation is there another way to use the built in
helpers?
Thanks
Kevin