I've been trying to run ASP.Net MVC 1.0 on one machine, but can't get past this. I create a new MVC project (C#). It creates all the folders, views, controllers, models etc. All good. Then, when I hit F5, I get the following:
d:\VSCode2008\MVC\MvcApplication1\Views\Shared\Site.Master(19): error CS0117: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'RenderPartial'
this happens at the following line:
httpHandler.ProcessRequest(HttpContext.Current); in Default.aspx.cs
It seems when it is trying to do a RenderPartial() to render the logon partial.
I have version 3.51 of .Net framework installed. I installed version 1.0 of MVC, and the assembly clearly has RenderPartial() as extension methods of HtmlHelper.
Anyone seen anything similar? I have found some posts about similar problems with betas and RCs but the suggested fixes have not woredk.
I am loving the theory of MVC but it is not letting me play!
RenderPartial(HtmlHelper, String) Renders the specified partial view by using the specified HTML helper. RenderPartial(HtmlHelper, String, Object) Renders the specified partial view, passing it a copy of the current ViewDataDictionary object, but with the Model property set to the specified model.
render('myview') will render the file 'myview', complete with the $layout that's specified in your controller. renderPartial('myview') will render ONLY the contents for 'myview'. And you can use it with special keys to retun result in varuiable and to echo this html where you want.
RenderAction(HtmlHelper, String) Invokes the specified child action method and renders the result inline in the parent view. RenderAction(HtmlHelper, String, Object) Invokes the specified child action method using the specified parameters and renders the result inline in the parent view.
Since you are referencing it in your Code Behind (ie. Default.aspx.cs) you need to include the namespace at the top of the file.
using System.Web.Mvc.Html;
is the Namespace that includes the RenderPartial extension method.
Just trying to rule out the obvious here, but can you make sure have this in the namespaces section of the web.config?
<add namespace="System.Web.Mvc.Html"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With