Quinntyne
Quinntyne

Reputation: 47

Html.RenderAction error

I have a ASP.NET MVC 1 application and using Visual Web Developer Express. I can not get the Html.RenderAction("Controller","Action") to work on my MasterPage. (Site.Master) in the Shared folder.

VWD says "Html" is not recognized here.

I took to the following steps to implement the Html.RenderAction("Controller","Action") method.

  1. Downloaded Micrsoft.Web.Mvc.dll

  2. Updated the web.config with a reference to Micrsoft.Web.Mvc.dll '

  3. I added a reference to Micrsoft.Web.Mvc.dll in my project manually.

I'm following the book: Pro ASP.NET MVC Framework by Steven Sanderson and downloaded the sample file where he covers this topic (Ch 4 - 6) and his sample file is giving me the same error?

Please help!

Thanks! Quinntyne

Upvotes: 1

Views: 1223

Answers (1)

super_seabass
super_seabass

Reputation: 1116

Sample code would help.

A few things:

  1. Html.RenderAction() is not available in MVC 1, it was added in MVC 2. That's probably not the cause of your error message though.
  2. When you say that you "added a reference in your web.config,", make sure you added the namespaces to the namespaces section:

            <add namespace="System.Web.Mvc" />
            <add namespace="System.Web.Mvc.Ajax" />
            <add namespace="System.Web.Mvc.Html" />
    

Adding that last one will probably address the issue.

Upvotes: 2

Related Questions