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.cshtmland defined like so:The
ProductFilterModellooks like this:I have a controller
ProductFilterControllerthat looks like this:When I go to the
Productspage and click onsearch, I get the error that it excepts aRenderModel, but I am passing it aProductFilterModelMy
SearchResults.cshtmllooks 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...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.