Print Page | Close Window

Verification not triggering

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2012
Forum Discription: For .NET 4.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=4389
Printed Date: 29-May-2024 at 10:22am


Topic: Verification not triggering
Posted By: gregweb
Subject: Verification not triggering
Date Posted: 27-Sep-2013 at 9:45am
I am trying to get Verification to work correctly on a CodeFirst project. Currently, I am not getting a red textbox, or a popup when the validation should fail. Perhaps there is a switch somewhere that I have not set to trigger the validation.

For example on a Phone Number entity:

        [DataMember]
        [Column("Ext")]
        [Bindable(true, BindingDirection.TwoWay)]
        [Editable(true)]
        [Display(Name = "Ext", AutoGenerateField = true)]
        [StringLength(3, MinimumLength = 3)]
        public string Ext
        {
            get;
            set;
        }

Then in the Textbox, it has the appropriate bindings:

<TextBox IsReadOnly="{Binding IsReadOnly}"
Text="{Binding Item.AreaCode, Mode=TwoWay, ValidatesOnDataErrors=True,
ValidatesOnExceptions=True,                                           UpdateSourceTrigger=PropertyChanged}" />

It seems to me this should be working.

Greg



Replies:
Posted By: kimj
Date Posted: 27-Sep-2013 at 4:32pm

Your binding is to Item.AreaCode.  Does that property have similar validation attributes?



Posted By: gregweb
Date Posted: 28-Sep-2013 at 7:28am
My code was foobar - I was setting the Attributes on the Ext field instead of the AreaCode field.


In any case, it's working now.

Greg



Print Page | Close Window