Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 931179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:27:32+00:00 2026-05-15T20:27:32+00:00

I discovered NHaml some days ago and it’s a great project. When I try

  • 0

I discovered NHaml some days ago and it’s a great project.

When I try to use MVC2 Html helpers like Html.LabelFor(), Html.TextBoxFor(); the views won’t compile.

Example:

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?)
0185:         textWriter.Write("              ");
0185:         textWriter.Write(Convert.ToString(Html.LabelFor(model => model.Username)));
0187:         textWriter.WriteLine();

error CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'TextBoxFor' and no extension method 'TextBoxFor' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
0194:         textWriter.Write("              ");
0194:         textWriter.Write(Convert.ToString(Html.TextBoxFor(model => model.Username)));
0196:         textWriter.WriteLine();

I tried to add assemblies and namespaces in the nhaml’s Web.config section but it doesn’t change anything.

I’m using :

  • System.Web.Mvc 2.0
  • .NET Framework 3.5 SP1
  • Nhaml 1.5.0.2 from git trunk (and tried other builds)

My NHaml configuration is:

<nhaml autoRecompile="true" templateCompiler="CSharp3" encodeHtml="false" useTabs="false" indentSize="2">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:27:33+00:00Added an answer on May 15, 2026 at 8:27 pm

    The problem is the view class contains a non-generic HtmlHelper. Or some new extension methods requires the ViewData.Model’s type.

    To correct this problem, change the property and instantiation in NHaml.Web.Mvc/NHamlMvcView.cs.

    //public HtmlHelper Html { get; protected set; } // line 42
    public HtmlHelper<TModel> Html { get; protected set; }
    
    //Html = new HtmlHelper( viewContext, this ); // line 37
    Html = new HtmlHelper<TModel>( viewContext, this );
    

    Rebuild and use 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I discovered GitHub some time ago, and I'm loving it. It's got an awesome
I discovered that in some cases a query like select usertable.userid, (select top 1
Just discovered the jQuery :contains() selector and would like to use it however the
I discovered that if I try to access a field in a record, e.g.:
Just discovered the Guava libraries project. Do these work with GWT?
This morning I discovered some strange behavior of the SmtpClient class (.net 3.5). Can't
I discovered an issue with Magento routing logic and I would like to see
I discovered a problem in my code when I try to bind multiple sockets.
I discovered that even numbers of overlapping shapes added to canvas like that: GeometryGroup
I discovered that the source of a bug in some code I was writing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.