Click here to Skip to main content
15,916,030 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi, I am doing a web pages using MVC but I have encountered a little problem is when I add @Html.Partial("anything", new Model {}) inside my div tag like:
HTML
<div id="dvPartialView">@Html.Partial("anything", new Model {})</div>


An error/red line appear below the Partial syntax states:
System.Web.WebPages.Html.HtmlHelper' does not contain a definition for Partial.....

May I know how can I solve it?

What I have tried:

1. Tried to look for missing namespace in Web.Config but none seems to be missed out.
2. Looked online for solution where I may missing a namespace:
HTML
<add namespace="System.Web.Mvc.Html" />
but did not.
Posted
Updated 12-Jul-16 20:41pm
v2
Comments
F-ES Sitecore 13-Jul-16 4:41am    
Do you have the namespaces in the web.config in the Views folder? Other issues that can cause this are a mistmatch in versions, where the version of the mvc assemblies referenced in your config file is not the version in the bin folder and there is no suitable bindingRedirect in the web.config.

This stuff should all work out of the box though, create a new MVC app in VisualStudio and see if it works, and if it does compare those config files (all of them) with the one in your own project.
Jamie888 13-Jul-16 21:48pm    
Sir, I have checked through the web.config in Views folder and the namespace indeed is there. Besides, I have compared both the versions of System.Web.Webpages and both are in 3.0.0.0

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900