+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Using RadWindowManager

Using RadWindowManager

8 posts, 1 answered
  1. David
    David  avatar
    78 posts
    Registered:
    29 Dec 2008
    11 Jan 2010
    Link to this post
    Hi all I just went through the Telerik help file and learn how to use the Radwindowmanager for a new requirement.  The control works great on my test page and I love the options.  However when I attempt to use the control in Sitefinity the page just reloads with no pop up. 

    My goal is to have a pop up form for an Email a Friend function.  Here is my test code.

    1 <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Forest"
    2             <Windows> 
    3                 <telerik:RadWindow runat="server" BackColor="Maroon" Behavior="Default"  
    4                     InitialBehavior="None" Left="" NavigateUrl="http://www.telerik.com"  
    5                     OpenerElementID="btnTelerik" Title="Telerik Web Site" Top=""
    6                 </telerik:RadWindow> 
    7                 <telerik:RadWindow ID="rwDialog" runat="server" Animation="FlyIn"  
    8                     AutoSize="True" Behavior="Default" Height="393px" InitialBehavior="None"  
    9                     Left="" Modal="True" NavigateUrl="EmailAFriend.aspx"  
    10                     OpenerElementID="btnEmailAFriend" Overlay="True" Top=""  
    11                     VisibleStatusbar="False" Width="526px"
    12                 </telerik:RadWindow> 
    13             </Windows> 
    14         </telerik:RadWindowManager> 
    15         <asp:Button ID="btnTelerik" runat="server" Text="Show Telerik Site" /> 
    16         <asp:Button ID="btnEmailAFriend" runat="server" Text="Email A Friend" /> 

    Above works outside of Sitefinity in a simple aspx page.  I attempt to do the same thing in a master page and also in a user control with no luck.  Am I missing a step somewhere/somehow?  I am using the latest version 3.7 Standard, currently in trial mode until the customer decides to purchase.

    Thanks,
    David
  2. David
    David  avatar
    78 posts
    Registered:
    29 Dec 2008
    11 Jan 2010
    Link to this post
    Update:  I just found a solution for the problem, I think:

    I ended up doing the following to get the RadWindow to work in the master page:

    1 <script type="text/javascript"
    2     function openWin() { 
    3         //get a reference to the RadWindow 
    4         var oWnd = $find("<%= rwDialog.ClientID %>"); 
    5         //use its client-side API to set its NavigateUrl (if needed) and show it  
    6         oWnd.setUrl("emailafriend.aspx");  
    7         oWnd.show(); 
    8     }  
    9 </script> 
    10  
    11                 <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Forest"
    12                     <Windows> 
    13                         <telerik:RadWindow ID="rwDialog" runat="server" Animation="FlyIn" AutoSize="True" 
    14                             Behavior="Default" Height="393px" InitialBehavior="None" Left="" Modal="True" 
    15                             NavigateUrl="EmailAFriend.aspx" OpenerElementID="btnEmailAFriend" Overlay="True" 
    16                             Top="" VisibleStatusbar="False" Width="526px"
    17                         </telerik:RadWindow> 
    18                     </Windows> 
    19                 </telerik:RadWindowManager> 
    20          
    21         <button onclick="openWin(); return false;">Email A Friend</button> 

    I guess I just need to pass a string into javascript function to make it re-useable and drop the OpenerElementID/NavigateURL.

    Thanks,
    David

  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 Jan 2010
    Link to this post
    Hello David ,

    You can use the following code in a user control as well.

    <script type="text/javascript">
     
        function test1() {
            var oManager = GetRadWindowManager();
            oManager.open(null, "RadWindow1");
        }
        function test2() {
            var oManager = GetRadWindowManager();
            oManager.open(null, "RadWindow2");
        }
    </script>
     
     
     
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Forest">
                    <Windows>
                        <telerik:RadWindow ID="RadWindow1" runat="server" BackColor="Maroon" Behavior="Default" 
                            InitialBehavior="None" Left="" NavigateUrl="http://www.telerik.com" >
                        </telerik:RadWindow>
                        <telerik:RadWindow ID="RadWindow2" runat="server" Animation="FlyIn" 
                            AutoSize="True" Behavior="Default" Height="393px" InitialBehavior="None" 
                            Left="" Modal="True" NavigateUrl="~/EmailAFriend.aspx" 
                            Overlay="True" Top="" 
                            VisibleStatusbar="False" Width="526px">
                        </telerik:RadWindow>
                    </Windows>
        </telerik:RadWindowManager>
         
         
    <button onclick="test1();return false;" class="Button" style="width: 190px">
       Open Telerik</button>
     
    <button onclick="test2();return false;" class="Button" style="width: 190px">
       Open EmailFriend</button>
        

    You can just call oManager.open and you do not have to find the Radwindow control, because you use the RadWindowManager instance. You can gather more information about RadWindowManager client side API from here.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Answered
  4. David
    David  avatar
    78 posts
    Registered:
    29 Dec 2008
    11 Jan 2010
    Link to this post
    Thanks Ivan, I was just looking for that info.  That will my code simple. 
  5. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    17 Dec 2010
    Link to this post
    Can I just place this on the page itself?

    When I use this code I get  --  "GetRadWindowManager is not defined"   with no popup.  If I put the above code directly on a test page without using sitefinity it will work!

    Thank you.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    17 Dec 2010
    Link to this post
    Hello Laura,

    I am not getting any errors using this code in the context of Sitefinity. You could try removing the manager and using instance of the RadWindow control

    <script type="text/javascript">
      
        function test1() {
     
            var oWnd1 = $find("<%= RadWindow1.ClientID %>");
            //set its NavigateUrl
            oWnd1.setUrl("http://www.telerik.com");
            oWnd1.show();
        }
        function test2() {
            var oWnd = $find("<%= RadWindow2.ClientID %>");
            oWnd.setUrl("http://www.sitefinity.com");
            oWnd.show();
        }
    </script>
      
      
      
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Forest">
                    <Windows>
                        <telerik:RadWindow ID="RadWindow1" runat="server" BackColor="Maroon" Behavior="Default"
                            InitialBehavior="None" Left="" >
                        </telerik:RadWindow>
                        <telerik:RadWindow ID="RadWindow2" runat="server" Animation="FlyIn"
                            AutoSize="True" Behavior="Default" Height="393px" InitialBehavior="None"
                            Left="" Modal="True"
                            Overlay="True" Top=""
                            VisibleStatusbar="False" Width="526px">
                        </telerik:RadWindow>
                    </Windows>
        </telerik:RadWindowManager>
          
          
    <button onclick="test1();return false;" class="Button" style="width: 190px">
       Open Telerik</button>
      
    <button onclick="test2();return false;" class="Button" style="width: 190px">
       Open EmailFriend</button>


    Greetings,
    Ivan Dimitrov
    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
  7. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    17 Dec 2010
    Link to this post
    Thank you. Got it.

    i want it to look like a link so I assumed to use asp:LinkButton .  Is that possible?

    And with asp:linkbutton, it is not accepting the cssclass. Do I need runat=server? Because when I add this it says there is a ) missing?!?!?
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    20 Dec 2010
    Link to this post
    Hi Laura,

    LinkButton requires runat="server". It is a server control.

    Greetings,
    Ivan Dimitrov
    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
Register for webinar
8 posts, 1 answered