Print Page | Close Window

Validation other than Grid or Dataform

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2188
Printed Date: 29-Jul-2026 at 12:23pm


Topic: Validation other than Grid or Dataform
Posted By: moni
Subject: Validation other than Grid or Dataform
Date Posted: 23-Sep-2010 at 11:56am
Hello People
 
I getting problem executing validated message. I wonder its working fine with
datagrid and dataform but on textbox its not executing.Its working fine in SL
but with Devforce seem to have problem.I looking for validation on textbox or
combo box.
any suggetion
 
 
Thanks



Replies:
Posted By: DenisK
Date Posted: 24-Sep-2010 at 8:26am
Hi moni;

Another customer has posted the same question as yours. Please refer to the following post:

http://www.ideablade.com/forum/forum_posts.asp?TID=2117&title=validation-on-textbox - http://www.ideablade.com/forum/forum_posts.asp?TID=2117&title=validation-on-textbox


Posted By: moni
Date Posted: 24-Sep-2010 at 12:05pm
Hi
I followed Previous thread and conclude that
we had same problem.Whenever try to fire exception its works
only with Data Form or Data Grid
Beacause its directed to property Metadata

I try to supply seperate class but property found ambiguish between fields
How we can we handle simple empty UI field or non selection field
with proper error.

Thanks


Posted By: DenisK
Date Posted: 24-Sep-2010 at 1:47pm
Moni;

I'm not sure I understand. Could you explain with code examples from your xaml class and the class that implements the IVerifierProvider interface?


Posted By: moni
Date Posted: 24-Sep-2010 at 1:59pm
Hi
This is my code

public partial class MARK : IbEm.Entity
    {

        public class verifierProvider : IVerifierProvider
        {
            public IEnumerable<Verifier> GetVerifiers(object verifierProviderContext)
            {
                List<Verifier> verifires = new List<Verifier>();
                //verifires.Add(checkForEmptyVerfier(MARK.PropertyMetadata.DESC));
                verifires.Add(checkForEmptyVerfier());
                return verifires;
            }

private static Verifier checkForEmptyVerfier()
            {
                Verifier v = new ForEmptyVerifier(typeof(MARK), MARK.PropertyMetadata.DESC.Name);
                v.VerifierArgs.ErrorMessageInfo.ErrorMessage = "here is some error";
                return v;
            }

            public class ForEmptyVerifier : PropertyValueVerifier
            {
                public ForEmptyVerifier(Type pType, string pPropertyName, string pDisplayName = null, bool? shouldTreatEmptyStringAsNull = null)
                    : base(new PropertyValueVerifierArgs(pType, pPropertyName, false, pDisplayName))
                {
                }
                protected override VerifierResult VerifyValue(object itemToVerify, object valueToVerify, TriggerContext triggerContext, VerifierContext verifierContext)
                {
                    string aString = (string)valueToVerify;
                    var result = (aString != string.Empty);
                    return new VerifierResult(result);
                }
            }




Posted By: moni
Date Posted: 24-Sep-2010 at 2:01pm
my xmal code

<telerik:RadMaskedTextBox HorizontalAlignment="Left" Margin="70,10,0,0" MaskType="None" Name="radMaskedTextBox1" TabIndex="0" VerticalAlignment="Top" Width="305" MaskedText="{Binding DESCO,Mode=TwoWay,UpdateSourceTrigger=Default, ValidatesOnExceptions=True,NotifyOnValidationError=True}"  />
            <telerik:RadComboBox  DisplayMemberPath="Descricao" HorizontalAlignment="Left" IsEditable="True" IsReadOnly="True" ItemsSource="{StaticResource ListComboYesNo}" Margin="70,38,0,0" Name="radComboBox1" SelectedValuePath="Valor" TabIndex="1" TabNavigation="Local" VerticalAlignment="Top" Width="145" />


Posted By: DenisK
Date Posted: 24-Sep-2010 at 2:12pm
Moni;

I've created a solution that should help you get started. Please click the link below.

http://wikisend.com/download/492914/SilverlightApplication1.zip - http://wikisend.com/download/492914/SilverlightApplication1.zip


Posted By: btitular
Date Posted: 14-Oct-2010 at 11:46pm

DenisK,

Can you please verify the link. I'm getting a reference to an excel file. I'd like to see this sample solution as well. Thanks!
 
Bob
 


Posted By: DenisK
Date Posted: 19-Oct-2010 at 11:08am
Bob;

Please try this link.

http://wikisend.com/download/477680/SilverlightApplication1.zip - http://wikisend.com/download/477680/SilverlightApplication1.zip


Posted By: abaptie
Date Posted: 06-Jan-2011 at 10:18am
Hi DenisK

Would it be possible to see that example - the link seems to be broken

Thanks

Andy


Posted By: DenisK
Date Posted: 06-Jan-2011 at 11:21am
Hi Andy;

Sorry, but I'm afraid I already deleted the sample from my machine as well.

Basically, all you need to do is set your DataContext to your entity and bind your TextBox to the property of that entity.

For example, if you have a StackPanel and a TextBox, your xaml code should look something like this.

<StackPanel DataContext="{Binding Employee}">

<TextBox Text="{Binding City, Mode=TwoWay, NotifyOnValidationError=true}" />

</StackPanel>

Hope this helps.

Denis



Print Page | Close Window