I am experiencing a strange behavior with RadWindowManager1.RadAlert
I have an aspx page with different controls(textbox,combobox etc).Same page comes as Radwindow in another asp page.
I am trying to save record and show "record added successfully" message via Radalert.
If I enter all the details correctly and click save button,I am getting the Radalert with message.But in case I show some error message as ,for eg "name is required",and then click save button by entering all required fields,I am not getting the RadAlert,but the record gets saved in the database.I am not sure is this is the exact reason behind.
Please find below my code.
aspx:
aspx.cs
I have an aspx page with different controls(textbox,combobox etc).Same page comes as Radwindow in another asp page.
I am trying to save record and show "record added successfully" message via Radalert.
If I enter all the details correctly and click save button,I am getting the Radalert with message.But in case I show some error message as ,for eg "name is required",and then click save button by entering all required fields,I am not getting the RadAlert,but the record gets saved in the database.I am not sure is this is the exact reason behind.
Please find below my code.
aspx:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> function openWinRefClinic() { window.radopen("FrmReferralClinicGrid.aspx", "RefClinicDialog"); } function confirmCallBackFn(arg) { if (arg == true) { document.getElementById("Button1").click(); } else { document.getElementById("Button2").click(); } } function alertAndNavigateDr() { window.location.href = "FrmReferralDoctorGrid.aspx"; } </script> </telerik:RadCodeBlock>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
<Windows>
<telerik:RadWindow ID="RefClinicDialog" Title="Referral Clinic Data" runat="server" Height="550px" Width="550px"
Left="150px" Behaviors="Close" />
</Windows>
</telerik:RadWindowManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RCCountry">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RCCity" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RbSave">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RbSave" />
<telerik:AjaxUpdatedControl ControlID="Message" />
<telerik:AjaxUpdatedControl ControlID="lblerror" />
<telerik:AjaxUpdatedControl ControlID="lblName" />
<telerik:AjaxUpdatedControl ControlID="emailValidator" />
<telerik:AjaxUpdatedControl ControlID="lblContact" />
<telerik:AjaxUpdatedControl ControlID="lblLicence" />
<telerik:AjaxUpdatedControl ControlID="lblScript" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RbClose">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RbClose" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
///protected void RbSave_Click1(object sender, EventArgs e) { if (RCDrName.Text == "") { lblName.Visible = true; RCDrName.Focus(); return; } if (RCClinic.SelectedIndex == 0) { lblerror.Visible = true; RCClinic.Focus(); return; } if (RTMobile.Text == "") { lblContact.Visible = true; RTMobile.Focus(); return; } if (RTLicenceNo.Text == "") { lblLicence.Text = "Please enter Health Authority License No!"; lblLicence.Visible = true; RTLicenceNo.Focus(); return; } if (!string.IsNullOrEmpty(Id)) { bool statusU = _refDoctorService.UpdateDoctor(refdoctor); if (statusU == true) { RadWindowManager1.RadAlert("Referral doctor data updated successfully!", 300, 100, "Update Referral Doctor", "alertAndNavigateDr", "myAlertImage.png"); } else { Message.InnerHtml = "Referral doctor data update failed"; return; } } else { //check if ref doctor exist string search = " where Fld_RefDocName='" + refdoctor.Fld_RefDocName + "'" + " and " + " Fld_ClinicID=" + refdoctor.Fld_ClinicID; bool check = _refDoctorService.DoctorExists(search); if (check == true) { RadWindowManager1.RadConfirm("Referral Doctor already exist!Do you want continue?", "confirmCallBackFn", 300, 100, null, "Warning", "myConfirmImage.png"); } else { bool result = _refDoctorService.SaveRefDoctor(refdoctor); if (result == true) { RadWindowManager1.RadAlert("Referral doctor added successfully!", 300, 100, "Add Referral Doctor", "alertAndNavigateDr", "myAlertImage.png"); } else { Message.InnerText = "Referral doctor is not added.Please try again!"; return; } } } } protected void Button1_Click(object sender, EventArgs e) { //moving the fields bool result = _refDoctorService.SaveRefDoctor(refdoctor); if (result == true) { RadWindowManager1.RadAlert("Referral doctor added successfully!", 300, 100, "Add Referral Doctor", "alertAndNavigateDr", "myAlertImage.png"); } else { Message.InnerText = "Referral doctor is not added.Please try again!"; return; } }