Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,
how to perform a compare validation on two textboxs in silverlight4.0?
(but i know this in asp.net.)

thanks
nareshrajuu
Posted

C#
//this is validation method
       protected bool Validation()
       {
           bool returnValue = false;
           try
           {
               if (string.IsNullOrEmpty(txt1.Text))
               {
                   Label1.Text = "Please Enter txtbox1 value";
                   returnValue = false;
                   txt1.Focus();
               }
               else if (string.IsNullOrEmpty(txt2.Text))
               {
                   Label1.Text = "Please Enter txtbox2 value";
                   returnValue = false;
                   txt2.Focus();
               }
               else if (txt1.Text != txt2.Text)
               {
                   Label1.Text = "Doesn't match the txtbox1 and txtbox2";
                   returnValue = false;
                   txt1.Focus();
               }
               else
               {
                   returnValue = true;
               }
           }
           catch (Exception Ex)
           {
               Label1.Text=Ex.Message
           }
           return returnValue;
       }
//in button click event or textchanged event you can write like this

 if (Validation())
                {
//do something here.....
                }
 
Share this answer
 
 
Share this answer
 
thank u very much to your reply.it will fulfill my task.
is there any way in teamfoundationserver to compare the validates a two fields in teamfoundationserver based on date?
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900