protected void Button1_Click(object sender, EventArgs e)
{
System.DateTime d1 = default(System.DateTime);
if (Strings.Len(Strings.Trim(txtName.Text)) == 0)
{
msg("Name Must Be Present");
txtName.Focus();
return;
}
if (CatList.SelectedIndex == 0)
{
msg("Select Sex");
CatList.Focus();
return;
}
if (Strings.Len(Strings.Trim(txtMobile.Text)) < 10)
{
msg("Invalid Mobile Number");
txtMobile.Focus();
return;
}
if (!Information.IsNumeric(txtMobile.Text))
{
msg("Invalid Mobile Number");
txtMobile.Focus();
return;
}
if (Strings.Len(Strings.Trim(txtEmail.Text)) > 0)
{
//if (!RegularExpressionValidator1.IsValid)
//{
// msg("Invalid Email ID");
txtEmail.Focus();
return;
//}
}
DoctorDTO objDoctor = new DoctorDTO();
objDoctor.DocName = txtName.Text;
objDoctor.DocSex = CatList.SelectedItem.Text;
objDoctor.DocCredential = txtCredential.Text;
objDoctor.DocAddress = txtAddress.Text;
objDoctor.DocRTel = txtRtel.Text;
objDoctor.DocCTel = txtCtel.Text;
objDoctor.DocMobile = txtMobile.Text;
objDoctor.DocEmail = txtEmail.Text;
objDoctor.DocImagePath = Image1.ImageUrl;
List<DoctorDTO> lstDoctors = objService.GetAllDoctors();
lstDoctors = new List<DoctorDTO>(
from l in lstDoctors
where l.DocProfileID.Equals((Session["userid"].ToString()))
select l
);
if (lstDoctors.Count > 0)
{
objService.UpdateAllDoctorDetails(objDoctor);
}
else {
objService.AddDoctorDetails(objDoctor);
}
}
In my asp.net page i am fetching certain details in text boxes of the details and i have a button to save the Data
On Button1_Click firstly a java script is called to check whether the data has to be saved or not then only Data will be saved
However the Debugger is not going to Button Click
Please help someone
If your javascript function return false, Button1_Click will not be fired