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;
}
if (Validation())
{
}