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

How to show the Pop Up Window Asynchronously

3 Answers 272 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pankaj
Top achievements
Rank 1
Pankaj asked on 10 Oct 2012, 06:09 PM
I am trying to open the Pop Up window Asynchronously. Due to lengthy Database operation. I am waiting to open the Pop up for approximately 35 seconds...The Problem gets worst when the internet speed is very slow. In that case a lot of time. I am using the below mentioned code...

<telerik:RadWindowManager
        ID
="RadWindowManager1"
        ShowContentDuringLoad
="false"
                VisibleStatusbar="false"
       
runat="server"
        VisibleOnPageLoad="false"
        Width="894px"
        Modal="true"
        Behaviors="None"
       
EnableEmbeddedSkins="false"
        EnableShadow="true"
        OnClientClose="OnClientClose"
       
ReloadOnShow="false">
     <Windows>
          <telerik:RadWindow ID="radPopup" runat="server" KeepInScreenBounds="true" EnableShadow="true" />
     </Windows>
</telerik:RadWindowManager>

My Query is, What should I do to open the Pop Up first and in the Background the Database Operation is being executed...and during this operation the user may be informed about the busy operation...

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 12 Oct 2012, 10:21 AM
Hello Pankaj,

You can open the RadWindow one the client (e.g. point it to a simple html page that reads "please wait"). See how to do that in the following help article: http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html. This can be, for example, the OnClientClick of a button. Then the button will perform a partial postback that will not dispose the RadWindow, the server code will execute and a script will be injected (http://www.telerik.com/help/aspnet-ajax/radwindow-troubleshooting-javascript-from-server-side.html) that will change the URL of the RadWindow to the desired page with the new content.

This is a general idea, it can be modified in different ways, but the main concept is to show the RadWindow on the client before a postback happens and that postback should be partial.


Greetings,
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.
0
Pankaj
Top achievements
Rank 1
answered on 16 Oct 2012, 07:33 PM
Hello Marin,

First, thanks for the response. Sorry for replying you very late. Actually I cannot send the complete HTML like this as you mentioned in you suggestion. Because we are following an already defined code convention.

Is there any way to do the Database Operation by keeping our self in the same Pop Up Page asynchronously? I meant I am in the Pop Up and some message is being shown to to the user like Please wait...

Thanks
Pankaj Garg
0
Accepted
Princy
Top achievements
Rank 2
answered on 17 Oct 2012, 07:56 AM
Hi Pankaj,

One suggestion is that you can show a loading panel as follows while the content loads.

ASPX:
<div id="loading" style=" width: 100px; height: 50px; display: none; text-align: center; margin: auto;">
    loading...
</div>
<asp:Button ID="RadButton1" runat="server" Text="RadButton1" OnClientClick="openRadWnd(); return false;" />
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
   <Windows>
      <telerik:RadWindow ID="RadWindow1" runat="server" NavigateUrl="url" ShowContentDuringLoad="false" OnClientShow="OnClientShow" OnClientPageLoad="OnClientPageLoad">
      </telerik:RadWindow>
   </Windows>
</telerik:RadWindowManager>

JS:
<script type="text/javascript">
    var loadingSign = null;
    var contentCell = null;
    function openRadWnd() {
        $find("<%=RadWindow1.ClientID %>").show();
    }
    function OnClientShow(sender, args) {
        loadingSign = $get("loading");
        contentCell = sender._contentCell;
        if (contentCell && loadingSign) {
            contentCell.appendChild(loadingSign);
            contentCell.style.verticalAlign = "middle";
            loadingSign.style.display = "";
        }
    }
    function OnClientPageLoad(sender, args) {
        if (contentCell && loadingSign) {
            contentCell.removeChild(loadingSign);
            contentCell.style.verticalAlign = "";
            loadingSign.style.display = "none";
        }
    }
</script>

Hope this helps.

Thanks,
Princy.
Tags
General Discussions
Asked by
Pankaj
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Pankaj
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or