Hi. I am trying to set up a member registration form in my Umbraco Cloud project, following the Creating a Member Umbraco.TV episode. I created the RegisterModel.cs file, but I am getting errors on my DataAnnotations.
The type or namespace name 'Required' could not be found (are you
missing a using directive or an assembly reference?)
I am including a using statement for "System.ComponentModel.DataAnnotations", but it is grayed out, suggesting it is not being used, and the "[Required]" and "[EmailAddress]" lines are underlined.
My full code is below. What could I be doing wrong? Since this is an Umbraco Cloud project, and this Model file exists in a Class Library, do I need to add a specific reference to the Class Library project? Any suggestions would be appreciated.
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace MyProject.Core.Models
{
public class RegisterModel
{
[Required]
public string Name { get; set; }
[Required]
[EmailAddress]
public string Email { get; set; }
[Required]
public string Password { get; set; }
}
}
I think I have this fixed. It looks like all I had to do was install the NuGet package "System.ComponentModel.Annotations" to the MyProject.Core project.
Error with DataAnnotations
Hi. I am trying to set up a member registration form in my Umbraco Cloud project, following the Creating a Member Umbraco.TV episode. I created the RegisterModel.cs file, but I am getting errors on my DataAnnotations.
I am including a using statement for "System.ComponentModel.DataAnnotations", but it is grayed out, suggesting it is not being used, and the "[Required]" and "[EmailAddress]" lines are underlined.
My full code is below. What could I be doing wrong? Since this is an Umbraco Cloud project, and this Model file exists in a Class Library, do I need to add a specific reference to the Class Library project? Any suggestions would be appreciated.
Thanks,
David
I think I have this fixed. It looks like all I had to do was install the NuGet package "System.ComponentModel.Annotations" to the MyProject.Core project.
is working on a reply...