November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi,
I think what you're looking for is something called a "viewmodel". A viewmodel is a model that you instantiate and populate based on your model and/or any other data you need the view to know about. Please read more about here -> http://stackoverflow.com/questions/11064316/what-is-viewmodel-in-mvc
Model PageType:SamplePage.cs
public virtual XhtmlString MainBody { get; set; }
Controller: SamplePageController.cs model = new PageViewModel(currentPage);
public ActionResult Index(SamplePage currentPage)
{
PageViewModel
return View(model);
}
SamplePage/Index.cshtml
@model EPiServerSite1.Models.ViewModels.PageViewModel
The above works fine.
But I am trying to send a different view in the controller like below:
public ActionResult Index(SamplePage currentPage) data = new List(Getvalues());
{
List
return View(model);
}
where
public class ABCBlockModel
{
public string Name { get; set; }
public double Score { get; set; }
public string Sector { get; set; }
}
so the Index can have
@model IEnumerable
But the view the tightly bound with SamplePage it seems. Can the view have 'ABCBlockModel'