but this dictionary requires a model item of type 'Umbraco.Web.Models.RenderModel'.
i've got the following error: "The model item passed into the dictionary is of type
'W3S.Controllers.ViewModelAgenda', but this dictionary requires a model
item of type 'Umbraco.Web.Models.RenderModel'."
UmbracoHelper help = new UmbracoHelper(UmbracoContext); ViewModelAgendaItems SubItems = new ViewModelAgendaItems(); SubItems.SubItems = help.TypedContent(model.Content.GetProperty("related6").Value.ToString().Split(',')); vmAgenda.Items = SubItems;
return CurrentTemplate(vmAgenda); } } public class ViewModelAgenda { //public RenderModel UModel {get;set;} public String Related {get;set;} public String Related2 {get;set;} public String Related3 {get;set;} public String Related4 {get;set;} public String Related5 {get;set;} public String Related6 {get;set;} public ViewModelAgendaItems Items { get; set; } } public class ViewModelAgendaItems { public IEnumerable<IPublishedContent> SubItems { get; set; } public IPublishedContent SubSubItems { get; set; } } }
but this dictionary requires a model item of type 'Umbraco.Web.Models.RenderModel'.
i've got the following error: "The model item passed into the dictionary is of type 'W3S.Controllers.ViewModelAgenda', but this dictionary requires a model item of type 'Umbraco.Web.Models.RenderModel'."
the example is pretty clear (last example): http://our.umbraco.org/documentation/Reference/Mvc/custom-controllers
and my code is this but still the problem? can somebody help me?
namespace W3S.Controllers
{
public class AgendaController : RenderMvcController
{
//
// GET: /Agenda/
public ActionResult Agenda(RenderModel model)
{
ViewBag.Title = model.Content.Name;
var vmAgenda = new ViewModelAgenda();
//Items.UModel = Model;
vmAgenda.Related = (String) model.Content.GetProperty("related").Value;
vmAgenda.Related2 = (String) model.Content.GetProperty("related2").Value;
vmAgenda.Related3 = (String) model.Content.GetProperty("related3").Value;
vmAgenda.Related4 = (String) model.Content.GetProperty("related4").Value;
vmAgenda.Related5 = (String) model.Content.GetProperty("related5").Value;
vmAgenda.Related6 = (String) model.Content.GetProperty("related6").Value;
UmbracoHelper help = new UmbracoHelper(UmbracoContext);
ViewModelAgendaItems SubItems = new ViewModelAgendaItems();
SubItems.SubItems = help.TypedContent(model.Content.GetProperty("related6").Value.ToString().Split(','));
vmAgenda.Items = SubItems;
return CurrentTemplate(vmAgenda);
}
}
public class ViewModelAgenda {
//public RenderModel UModel {get;set;}
public String Related {get;set;}
public String Related2 {get;set;}
public String Related3 {get;set;}
public String Related4 {get;set;}
public String Related5 {get;set;}
public String Related6 {get;set;}
public ViewModelAgendaItems Items { get; set; }
}
public class ViewModelAgendaItems {
public IEnumerable<IPublishedContent> SubItems { get; set; }
public IPublishedContent SubSubItems { get; set; }
}
}
@inherits Umbraco.Web.Mvc.UmbracoViewPage<W3S.Controllers.ViewModelAgenda>
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Agenda2</h2>
1 @Model.Related<br />
2 @Model.Related2<br />
3 @Model.Related3<br />
4 @Model.Related4<br />
5 @Model.Related5<br />
6 @Model.Related6<br />
@foreach (var node in Model.Items.SubItems) {
<div>
<h3>@node.GetProperty("detailTitel")</h3>
@node.GetProperty("link")
</div>
}
is working on a reply...