public class ProductFilterModel
{
public string Make { get; set; }
public string Model { get; set; }
public string Year { get; set; }
public string Engine { get; set; }
}
I have a controller ProductFilterController that looks like this:
public class ProductFilterController : SurfaceController
{
[HttpPost]
public ActionResult SearchResults(
ProductFilterModel productFilterModel)
{
return View(productFilterModel);
}
}
When I go to the Products page and click on search, I get the error that it excepts a RenderModel, but I am passing it a ProductFilterModel
OK, I figured it out or at least it is one way of solving it. I ended up inheriting from RenderModel, but this isn't enough because once I inherit from RenderModel, it doesn't have any parameterless constructors, so I had to add the following line:
public ProductFilterModel():
this(new UmbracoHelper(UmbracoContext.Current).
TypedContent((UmbracoContext.Current.PageId)))
{
}
RenderModel expected error?
I have a partial view called
ProductFilter.cshtml
. It is in a viewProducts.cshtml
and defined like so:The
ProductFilterModel
looks like this:I have a controller
ProductFilterController
that looks like this:When I go to the
Products
page and click onsearch
, I get the error that it excepts aRenderModel
, but I am passing it aProductFilterModel
My
SearchResults.cshtml
looks like this:If I remove the Master, everything works, but I lose all styling.
OK, I figured it out or at least it is one way of solving it. I ended up inheriting from
RenderModel
, but this isn't enough because once I inherit fromRenderModel
, it doesn't have any parameterless constructors, so I had to add the following line:is working on a reply...