none
How To get objects of MetadataType in other class where we create their type cast

    Discussão Geral

  •    

    public class EmployeeMetaData
        {
           public  string _EmpId;
            [Required(ErrorMessage = "Enter EmployeeId.")]
            [StringLength(5, ErrorMessage = "EmpId Is Not More Then 5 Characters.")]
            public string EmpId
            {
                get
                {
                    return _EmpId;
                }
                set
                {
                    _EmpId = value;
                }
            }
        }


     [MetadataType(typeof(EmployeeMetaData))]
        public class Employee
        {
        }

    Default.aspx

    protected void Page_Load(object sender, EventArgs e)
            {
                try
                {
                    Employee objEmployee = new Employee();
                    
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
            }

    Here I want to get all properties of Employee Class. How can I?
    sexta-feira, 9 de março de 2012 13:48

Todas as Respostas