hello
i want to run this code,where all fields is not null then Query will be Executed,if not then message will be displayed
private bool IsValidationSuccess()
{
try
{
if (string.IsNullOrEmpty(txtCompanyName.Text.Trim())
{
try
{
if (string.IsNullOrEmpty(txtCompanyName.Text.Trim())
&& string.IsNullOrEmpty(txtCompanyAddress1.Text) &&string.IsNullOrEmpty(txtPincode.Text.Trim())
&& cmbDistrict.SelectedIndex <=0 && cmbTaluka.SelectedIndex <=0)
{
return false;
}
else
{
return true ;
}
}
catch (SqlException ex)
{
throw ex;
}
&& cmbDistrict.SelectedIndex <=0 && cmbTaluka.SelectedIndex <=0)
{
return false;
}
else
{
return true ;
}
}
catch (SqlException ex)
{
throw ex;
}
//on button click
if (IsValidationSuccess())
{
AddCompanyDetails();
}
else
{
MessageBox.Show("Please fill Compulsary(*) field");
}
///////////////////////////////
{
AddCompanyDetails();
}
else
{
MessageBox.Show("Please fill Compulsary(*) field");
}
///////////////////////////////
error:when all field contain data it returns false,and message box is displayed .
Sujeet SumanPosted Feb 3, 2016, 11:01 AM
|| cmbDistrict.SelectedIndex <=0 || cmbTaluka.SelectedIndex <=0)
return false;
}
else
{
return true ;
}
Sujeet SumanPosted Feb 5, 2016, 10:14 PM
Priya MPosted Feb 4, 2016, 5:18 AM
Abhay ShankerPosted Feb 3, 2016, 8:21 PM