Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# ASP.NET MVC Forms Adding Form Validation Adding Server-Side Validations Using Data Annotations

what could be wrong with this code

pliz tel me what i am missing n what need to be added n removed

Issue.cs
using System.ComponentModel.DataAnnotations;

namespace IssueReporter.Models
{
    public class Issue
    {
        public enum SeverityLevel
        {
            Minor,
            Major,
            Critical
        }

        public int Id { get; set; }
        public string Name { get; set; }
        public string Email { get; set; }
        [Display(Name = "Department")]
        public int DepartmentId { get; set; }
        public Department Department { get; set; }
        public SeverityLevel Severity { get; set; }
        public bool Reproducible { get; set; }
        [Display(Name = "Description of Problem")]
        [Required(Name = "DescriptionOfProblem")]
        public string DescriptionOfProblem { get; set; }
    }
}

1 Answer

Steven Parker
Steven Parker
221,106 Points

The "[Required]" annotation doesn't take any parameters, it looks just as shown in the instructions (and here).

Also, the instructions tell you to add it to two of the properties. But sure to put it on both of them.