This is a migrated thread and some comments may be shown as answers.

Radalert Issue

1 Answer 56 Views
Window
This is a migrated thread and some comments may be shown as answers.
Soumya
Top achievements
Rank 1
Soumya asked on 01 Aug 2012, 06:54 AM
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:
<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>
///
aspx.cs
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;
          }
      }

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 03 Aug 2012, 10:22 AM
Hi Soumya,

I would advise that you examine your pages for a JavaScript error as it can prevent the RadAlert from showing. The following help article can also be useful in troubleshooting such a problem: http://www.telerik.com/help/aspnet-ajax/window-troubleshooting-dialogs-from-the-server-methods.html.

I also advise that you review your server-side logic, as something there may be preventing the entire call to RadAlert(), some additional validation check or custom logic. I suggest you add a breakpoint and step through your code to see where the issue originates.


Regards,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Window
Asked by
Soumya
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or