locked
DisplayName is not working, Validation message neither. RRS feed

  • Question

  • User-1759624489 posted

     Hello. I want to customize Column names and validation errors.

     

    I tried the following:

     

    It doesnt show errors but I cant see any change on the page.

     

        [MetadataType(typeof(WarrantyMetaData))]
        public partial class Warranty
        {

        }

      
        public class WarrantyMetaData
        {
            public object id { get; set; }
           
            [Required(ErrorMessage="Este campo es Requerido")]
            [DisplayName("Tiempo de la Garantia")]
            public object time { get; set; }

        }

    Thursday, August 28, 2008 11:37 AM

Answers

  • User660823006 posted

    If this doesn't work you need to check and see if the entity you are extending (Warranty) is in a namespace and add that appropriately. My favorite test is to remove "partial" from "class Warranty". This SHOULD generate a compile time error if your class is named correctly. If you don't get a compile error then go check and see if your data model objects are in a namespace or you mis-spelled it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 28, 2008 12:20 PM

All replies

  • User660823006 posted

    If this doesn't work you need to check and see if the entity you are extending (Warranty) is in a namespace and add that appropriately. My favorite test is to remove "partial" from "class Warranty". This SHOULD generate a compile time error if your class is named correctly. If you don't get a compile error then go check and see if your data model objects are in a namespace or you mis-spelled it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 28, 2008 12:20 PM
  • User-1759624489 posted

     That wasnt the error, the problem is that the property was Time and I wrote time on the metadata class.

     

    Thanks!!

    Thursday, August 28, 2008 12:34 PM
  • User1641955678 posted

    In theory, if we see a property name in your metadata class that we don't recognize, you should get an explicit error.  I don't know why that didn't happen.  Does it complain if you add a random property named Foo in WarrantyMetaData?

    David

    Thursday, August 28, 2008 4:26 PM