Question

Im using Rad ajax manager, RadAjaxLoadingPanel in my webform.

I have two panels in my form, Panel1 is having Create account controls and another Panel2 is for Thank you notes.

When user created an account successfully i need to hide Panel 1 and show Panel 2. Im using ResponseEnd method to do make visible/hide using Javascript below method.

function ResponseEnd(sender, arguments) {
    //hide the loading panel and clean up the global variables 
     if (currentLoadingPanel != null) {
        currentLoadingPanel.hide(currentUpdatedControl);
     }
     ShowTY();
    currentUpdatedControl = null;
    currentLoadingPanel = null;

   }
function ShowTY(){
      document.getElementById('<%= Panelty.ClientID %>').style.visibility = "visible";
      document.getElementById('<%= Panelty.ClientID %>').style.display = "block";
      document.getElementById('<%= Panelsu.ClientID %>').style.visibility = "false";
      document.getElementById('<%= Panelsu.ClientID %>').style.display = "none";
  }

If user already exist or any db server error i need show Panel1 display error message in a Label For this I need to write a condition to check whether server response succeeded or not in the above method.

Please let me know how i can know the server response or how i can handle this issue..... Please reply soon

Thanks

Was it helpful?

Solution

According to the documentation: There is no way to pass data from an event on the server to the client side event handler.

I would suggest moving the logic to configure the display (hiding/showing elements, displaying error messages) to the server, where the code to create the account is. Since you are using the loading panels, this should be straightforward:

if(accountCreatedSuccessfully) {
     Panelty.Visible = true;
     Panelsu.Visible = false;
}
else {
     // TODO: display the error messages somewhere, in a label
     Panelty.Visible = false;
     Panelsu.Visible = true;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top