But I can't get it to work. I'm getting this error:
Compiler Error Message: CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'GetPropertyValue' and no extension method 'GetPropertyValue' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
If I remote @item.getPropertyValue... I get the "Context Must Implement System.Web.WebPages.WebPage" error. What am I doing wrong?
<?xmlversion="1.0"?><configuration><system.web.webPages.razor><hostfactoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/><pagespageBaseType="System.Web.Mvc.WebViewPage"><namespaces><addnamespace="System.Web.Mvc"/><addnamespace="System.Web.Mvc.Ajax"/><addnamespace="System.Web.Mvc.Html"/><addnamespace="System.Web.Routing"/><addnamespace="Umbraco.Web"/><addnamespace="Umbraco.Core"/><addnamespace="Umbraco.Core.Models"/><addnamespace="Umbraco.Web.Mvc"/></namespaces></pages></system.web.webPages.razor><appSettings><addkey="webpages:Enabled"value="false"/></appSettings><system.web><httpHandlers><addpath="*"verb="*"type="System.Web.HttpNotFoundHandler"/></httpHandlers><!-- Enabling request validation in view pages would cause validation to occur after the input has already been processed by the controller. By default MVC performs request validation before a controller processes the input. To change this behavior apply the ValidateInputAttribute to a controller or action. --><pagesvalidateRequest="false"pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"><controls><addassembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"namespace="System.Web.Mvc"tagPrefix="mvc"/></controls></pages></system.web><system.webServer><validationvalidateIntegratedModeConfiguration="false"/><handlers><removename="BlockViewHandler"/><addname="BlockViewHandler"path="*"verb="*"preCondition="integratedMode"type="System.Web.HttpNotFoundHandler"/></handlers></system.webServer></configuration>
The XML looks broken but it's probably just the posting here. Generally the contents looks ok.
Is your MacroPartial being saved in the /Views/MacroPartials folder? Also how are you rendering the Macro, through RTE or in a template (Webforms or Mvc?)?
I reposted the web.config, dunno why the formatting went brokered! :)
I'm getting the errors I listed in my first post in the /umbraco/#developer -->Scripting files --> *.cshtml file. It wont let me save it. Normally I use WebMatrix. WebMatrix let's me save the file, but it returns an error. I could send you the link to the homepage (the URL page that gets the error) in a PM if you want.
In WebMatrix, the CSHTML files are stored in MacroScripts.
MacroScripts folder should only be used to store the legacy Razor Macros. What you are creating here is a Partial View Macro and these must be stored in /Views/MacroPartials otherwise it will not work.
Context Must Implement System.Web.WebPages.WebPage
Hello,
I'm trying to get a page to show all PDF files in a media folder (ID is 2465).
I have the following code:
But I can't get it to work. I'm getting this error:
Compiler Error Message: CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'GetPropertyValue' and no extension method 'GetPropertyValue' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
If I remote @item.getPropertyValue... I get the "Context Must Implement System.Web.WebPages.WebPage" error. What am I doing wrong?
Thanks in advance.
Hi Annfinn,
Two quick questions, what version of Umbraco are you using and could you please post the content of your /Views/Web.Config file?
Thanks,
Jeavon
Hello,
Thanks for getting back to me.
Web.config:
Version: Umbraco v6.1.5 (Assembly version: 1.0.4993.19246)
The XML looks broken but it's probably just the posting here. Generally the contents looks ok.
Is your MacroPartial being saved in the /Views/MacroPartials folder? Also how are you rendering the Macro, through RTE or in a template (Webforms or Mvc?)?
Hello Jeavon,
I reposted the web.config, dunno why the formatting went brokered! :)
I'm getting the errors I listed in my first post in the /umbraco/#developer -->Scripting files --> *.cshtml file. It wont let me save it. Normally I use WebMatrix. WebMatrix let's me save the file, but it returns an error. I could send you the link to the homepage (the URL page that gets the error) in a PM if you want.
In WebMatrix, the CSHTML files are stored in MacroScripts.
Any thoughts?
Ah ok, that's the problem.
MacroScripts folder should only be used to store the legacy Razor Macros. What you are creating here is a Partial View Macro and these must be stored in /Views/MacroPartials otherwise it will not work.
Are you using WebForms or MVC template?
Jeavon
p.s. you create them in "Developer -> Partial View Macro Files"
Funny how that worked like a charm! :)
Thanks allot!! :D
To answer your question, I'm using WebForms.
Great, use Partial View Macros for all of your logic, that is the recommend approach for v6/v7 Webforms.
I can currently render macros in webforms like this:
I don't need to create a Macro in the backoffice. This method has been great to use with uSiteBuilder.
I want the same funcationality with Partal View Macro.
How would render a Partial View Macro in v6 using webforms without creating a macro in the backoffice?
is working on a reply...