13

I'm just in the process of upgrading my Preview 5 application to Beta 1, and I'm nearly there save for this one error when trying to render a control:

'System.Web.Mvc.HtmlHelper' does not contain a definition for 'RenderPartial' and no extension method 'RenderPartial' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)

My markup (in the .aspx View Content Page) is:

<% Html.RenderPartial("Controls/UserForm", ViewData); %>

I've tried using Microsoft.Web.Mvc but to no avail. Does anyone know where Html.RenderPartial has gone, or what alternative I could use?

4
  • They sure love moving stuff around :) Commented Oct 17, 2008 at 9:17
  • Yeah, I think they get some kind of sick pleasure from it... Commented Oct 17, 2008 at 9:19
  • Great question - we're upgrading to 1.0 from Preview 5 today and this really helped! Commented Apr 9, 2009 at 22:06
  • Well, as annoying as it is, better they get it right during the Beta than have to change it after the RTM. Commented May 26, 2009 at 15:56

3 Answers 3

10

And also don't forget to add namespaces like below to the web config, I think preview 5 default web.config does not have System.Web.Mvc.Html in it:

<namespaces>
 <add namespace="System.Web.Mvc"/>
 <add namespace="System.Web.Mvc.Ajax"/>
 <add namespace="System.Web.Mvc.Html"/>
 <add namespace="System.Web.Routing"/>
 <add namespace="System.Linq"/>
 <add namespace="System.Collections.Generic"/>
</namespaces>
Sign up to request clarification or add additional context in comments.

Comments

9

Now fixed - the conflict was a difference in Web.config requirements between Preview 5 and Beta 1. The following needs to be added into the system.web compilation assemblies node:

<add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

After this change, all of my old HtmlHelper methods magically came back!

Comments

2

In addition to adding the assembly reference I also had to add the line

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

to the pages/namespaces section in web.config file.

1 Comment

In addition to this you need to ensure the compiler is set to 3.5: stackoverflow.com/questions/944015/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.