I'm trying to validate the email id.But i'm not getting .Here i attached my code.
if (txtEmailID.Text == "")
try
{
bool isEmail = Regex.IsMatch(txtEmailID.Text.Trim(), @"\A(?:[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)\Z");
if (txtEmailID.Text == "")
{
focustextbox.Text = txtEmailID.ID;
ShowPopUpMsg("Email ID must be given");
// throw new ApplicationException("Email ID must be given");
}
else if (!isEmail)
{
focustextbox.Text = txtEmailID.ID;
ShowPopUpMsg("Invalid E-Mail");
//throw new ApplicationException("Invalid E-Mail");
}
}
catch (Exception ex)
{
oErrorLog.WriteErrorLog(ex.ToString());
}
finally
{
if (objSqlDataReader != null)
{
objSqlDataReader.Dispose();
objSqlDataReader.Close();
}
}
}
catch (Exception ex)
{
oErrorLog.WriteErrorLog(ex.ToString());
}
finally
{
if (objSqlDataReader != null)
{
objSqlDataReader.Dispose();
objSqlDataReader.Close();
}
}