I'm new to Umbraco and MVC - can anyone help with the following?
I have a master template (Root.cshtml) which has templates nested below it. In some of these I want to use custom models, however Root.cshtml needs access to the Umbraco helper.
So the nested pages inherit from Umbraco.Web.Mvc.UmbracoViewPage<CustomModel>, whilst Root.cshtml needs to inherit from something more general.
I've tried having my custom models inherit from Umbraco.Web.Models.RenderModel however I keep being told that either my custom model does not contain a constructor that takes 0 arguments or, or if I give it one, that 'Umbraco.Web.Models.RenderModel' does not contain a constructor that takes 0 arguments
What am I doing wrong and how should I accomplish this nesting?
namespace CRuMbraco.Web.Models {
public class RegisterModel : RenderModel {
[Required]
[Display(Name = "Customer code")]
public string CustomerCode { get; set; }
[Required]
[DataType(DataType.EmailAddress)]
[Display(Name = "Email address")]
public string Email { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
[DataType(DataType.EmailAddress)]
[Display(Name = "Confirm email")]
[Compare("Password", ErrorMessage = "The e-mail and confirmation e-mail do not match.")]
public string ConfirmEmail { get; set; }
[Required]
[Display(Name = "FirstName")]
public string FirstName { get; set; }
[Required]
[Display(Name = "LastName")]
public string LastName { get; set; }
}
}