Last active
May 10, 2017 18:49
-
-
Save sebastiandammark/e25ef34e3739ece2cfd71bc0a4218f36 to your computer and use it in GitHub Desktop.
The best overloaded method match for 'ASP._Page_Views_Master_cshtml.RenderContent(ASP.Textelement)' has some invalid arguments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<Website> | |
| <!DOCTYPE html> | |
| <head> | |
| <title>Test Helpers Page</title> | |
| </head> | |
| <body> | |
| @{ | |
| var moduleList = Model.Content.Modules.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); | |
| var moduleCollection = Umbraco.Content(moduleList); | |
| foreach (var module in moduleCollection) | |
| { | |
| @RenderContent((dynamic) module); | |
| } | |
| } | |
| </body> | |
| </html> | |
| @helper RenderContent(Textelement module) | |
| { | |
| <div>Textelement</div> | |
| } | |
| @helper RenderContent(Fullwidthmedia module) | |
| { | |
| <div>Fullwidthmedia</div> | |
| } |
Author
you could add
@Helper RenderContent(IPublishedContent content) {
switch content.DocumentTypeAlias
{
case "Textelement":
@RenderContent((Textelement)content)
break;
case "Fullwidthmedia":
@RenderContent((Fullwidthmedia)content)
break;
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#pragma warning disable 0109 // new is redundant
public new const string ModelTypeAlias = "fullwidthmedia";
public new const PublishedItemType ModelItemType = PublishedItemType.Content;
#pragma warning restore 0109
#pragma warning disable 0109 // new is redundant
public new static PublishedContentType GetModelContentType()
{
return PublishedContentType.Get(ModelItemType, ModelTypeAlias);
}
#pragma warning restore 0109