RadWindow Custom Popup Window Depending on URL

4 posts, 0 answers
  1. Manuel Ortiz
    Manuel Ortiz avatar
    68 posts
    Member since:
    Aug 2009

    Posted 26 May 2010 Link to this post

    Hello, I have a RadWindow Modal Popup Window  that opens a URL I send it.  I would like the Window's Loading Image to change depending on the URL I am opening... for example... if I send page1.aspx URL I want page1loader.gif to be the loading image, and if I send it page2.aspx URL I want page2loader.gif to be the loading image.  How can I accomplish this?

    Thanks,
    Manuel
  2. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 26 May 2010 Link to this post

    Hi Manuel,

    You should handle RadWindow's OnClientShow client-side event, and set new background image to the RadWindow's content cell. I created a simple example for you, which illustrates how to accomplish this goal:
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title></title>
         
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <script type="text/javascript">
            function WindowShow(oWin, args)
            {
                //Get the content cell which is used to show the loading image as background-image
                var contentCell = oWin.get_contentFrame().parentNode;
                var navigateUrl = oWin.get_navigateUrl();
      
                var newImageUrl;
                //Set new image url depending on navigateUrl
                switch (navigateUrl)
                {
                    case "ContentWindow1.aspx":
                        {
                            newImageUrl = "url(1.gif)";
                            break;
                        }
                    case "ContentWindow2.aspx":
                        {
                            newImageUrl = "url(2.jpg)";
                            break;
                        }
                }
                //Only set new image if we know the page. Otherwise it will be with the "default" image
                if (newImageUrl != null)
                {
                    contentCell.style.backgroundImage = newImageUrl;
                }
            }
        </script>
        <div>
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
                <Windows>
                    <telerik:RadWindow ID="RadWindow1" VisibleOnPageLoad="true" NavigateUrl="ContentWindow1.aspx" OnClientShow="WindowShow" Left="100px"></telerik:RadWindow>
                    <telerik:RadWindow ID="RadWindow2" VisibleOnPageLoad="true" NavigateUrl="ContentWindow2.aspx" OnClientShow="WindowShow" Left="300px"></telerik:RadWindow>
                </Windows>
            </telerik:RadWindowManager>
        </div>
        </form>
    </body>
    </html>
    Let us know if you have any other questions.

    All the best,
    Petio Petkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Mo
    Mo avatar
    3 posts
    Member since:
    Oct 2010

    Posted 22 Oct 2010 Link to this post

    Hi, below custom rad window will open on button click. I am unable to see the content inside the rad window when it opens!.
    I am trying to navigate to the page which has active web viewer report.
    I dont know where i am doing wrong?!! Please help me

    function openPrompt()      
                    {   
                        var url = "../Forms/NoRecordFoundReport.aspx?";
                          var t = window.radprompt(null, callbackFn)
                          t.setSize(800,500);
                          t.Center();
                          t.ShowContentDuringLoad="true";
                          t.KeepInScreenBounds="true";                      
                        var oWnd = t;
                        oWnd.SetUrl(url);                  
                    }
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server">   
                <PromptTemplate>             
                        <style type="text/css">   
                            body   
                            {   
                                background: white;   
                                font: normal 11px Verdana, Arial, Sans-serif;  
                                overflow: hidden;   
                            }   
                                          
                            .FixedDiv   
                            {   
                                font: normal 11px Verdana, Arial,Sans-serif;   
                                margin: 3px;   
                                color: black;   
                                text-align: center;
                                                        
                            }   
                       </style>  
                                     
                            <div class="FixedDiv">   
                              
                            </div>  
                        
                </PromptTemplate> 
                <Windows>
                    <telerik:RadWindow ID="SampleRadWindow" NavigateUrl="../ZWorking/RecordFlagTest.aspx?" ></telerik:RadWindow>
                </Windows>  
            </telerik:RadWindowManager>  
            <button onclick="openPrompt(); return false;">radWindow</button>  


  4. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 26 Oct 2010 Link to this post

    Hi Mo,

    You are trying to use radpropmt() which opens radprompt dialog is intended to be used as the standard window.prompt() replacement. What you need to use is radopen(). Also, the settings that you try to apply are not correct - you should use the client-side API instead.

    Best wishes,
    Georgi Tunev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top