"Cannot bind source type .. to model type Umbraco.Web.Models.RenderModel." bit of help needed
So I have a page, say just has one button generated like this,
using (Html.BeginUmbracoForm("GoAddPerson", "PersonSurface", null, new { name = "myForm" }))
{
<input type="submit"/>
}
This then calls a controller method which aims to return a new view
[ValidateInput(false)]
[HttpPost]
public ActionResult GoAddPerson()
{
var m = new myproj.Models.PersonAddModel();
return View("~/Views/PersonAdd.cshtml", m);
}
But when tried, it just throws the Exception in the subject line .. If I make my model inherit from RenderModel then it works fine, and that is what I usually do, however I understand it doesn't have to inherit from RenderModel and in this case it is not useful to .. so just wonder what I am doing wrong here, and why the exception?
"Cannot bind source type .. to model type Umbraco.Web.Models.RenderModel." bit of help needed
So I have a page, say just has one button generated like this,
This then calls a controller method which aims to return a new view
But when tried, it just throws the Exception in the subject line .. If I make my model inherit from RenderModel then it works fine, and that is what I usually do, however I understand it doesn't have to inherit from RenderModel and in this case it is not useful to .. so just wonder what I am doing wrong here, and why the exception?
Thanks in advance for any help
If you are trying to return a model to an Umbraco view then it will need to inherit from RenderModel, I believe.
If you are just processing a model (eg. a contact form or login) and aren't returning it to a view, then you can use any plain POCO model.
Thanks a lot .. ok I get it now .. to not inherit from RenderModel I need to move the code into a partial view and call that with the model.
is working on a reply...