Click here to Skip to main content
15,880,469 members
Articles / Web Development / ASP.NET

MVC Application - Part 2 - Error Display

Rate me:
Please Sign up or sign in to vote.
2.50/5 (3 votes)
6 Jul 2010CPOL4 min read 27.4K   8  
An application to demonstrate MVC error display.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Web.DynamicData;
using System.ComponentModel.DataAnnotations;
using System.Resources;
using Social2.Properties;

namespace Social2.Models
{
    [MetadataType(typeof(Employee_Metadata))]
    public partial class Employee
    {
        public partial class Employee_Metadata
        {

            //        [Required]
            //        [Required(ErrorMessage="Field required")]
            //        [StringLength(5)]
            //        [StringLength(50, ErrorMessage="must be under 50 characters" ]
            //        [Range(3,15)]
            //        [RegularExpression(@"^\$?\d+(\.(\d{2}))?$")]
            //        [DataType(DataType.Date)]
            //        [Required(ErrorMessage = "Fieldssss required")]
            //        [StringLength(10, ErrorMessage = "Comment Must be under 10 Characters")]

            [DisplayName("Idd")]
            [Description("Id Key")]
            public global::System.Int32 Emp_Id { get; set; }

            [DisplayName("First Name")]
            [Description("Employee First Name")]
            [StringLength(30, ErrorMessage = "First Name Must be under 30 Characters")]
            [Required]
            public global::System.String Emp_FirstName { get; set; }

            [DisplayName("Middle Name")]
            [Description("Employee Middle Name")]
            [StringLength(30, ErrorMessage = "Middle Name Must be under 30 Characters")]
            public global::System.String Emp_MiddleName { get; set; }

            [DisplayName("Last Name")]
            [StringLength(30, ErrorMessageResourceType = typeof(Resource), ErrorMessageResourceName = "StrLastNameength")]
            [Required]
            public global::System.String Emp_LastName { get; set; }

            [DisplayName("Gender")]
            [Required]
            public global::System.String Emp_Gender { get; set; }

            [DisplayName("Birth Monthh")]
            public global::System.Int32 Emp_BirthMonth { get; set; }

            [DisplayName("Birth Dayy")]
            public global::System.Int32 Emp_BirthDay { get; set; }

            [DisplayName("City")]
            public global::System.String Emp_City { get; set; }

            [DisplayName("State")]
            public global::System.String Emp_State { get; set; }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
I am a Director of Engineering, have an MBA and work in C# forms, Asp.Net and vb.net. I have been writing Windows program since windows 3.0. I am currently working in the Healthcare industry.

I enjoy reading, music (most types), and learning new technology. I am involved in opensource projects at codeplex.

My linkedin link is
http://www.linkedin.com/in/donsweitzer

Comments and Discussions