radwindow and radcontextmenu

7 posts, 2 answers
  1. jorge
    jorge avatar
    23 posts
    Member since:
    Apr 2007

    Posted 21 Apr 2009 Link to this post

    Posted on the menu forum, but have not gotten a response.  There seems to be some kind of problem when using a radwindow as a response to a contextmenu item click.  Once you click on the menu item, you get a javascript error, 'type' is null or not an object, in a dynamic Telerik.Web.UI code.  This is on Q1 2009.

    Here is a very simple page to reproduce the issue:

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>    
        
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">    
        
    <html xmlns="http://www.w3.org/1999/xhtml">     
    <head runat="server">     
        <title></title>     
        <script language="javascript" type="text/javascript">     
        
            function onClicking(sender, eventArgs) {     
                var item = eventArgs.get_item();     
        
                var oManager = GetRadWindowManager();     
                var navigateUrl = item.get_navigateUrl();     
        
                eventArgs.set_cancel(true);     
        
                if (navigateUrl && navigateUrl != "#") {     
                    oManager.open(navigateUrl, "document");     
        
                }     
            }     
        
        </script>    
    </head>    
    <body>    
        <form id="form1" runat="server">     
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">     
        </telerik:RadScriptManager>    
        <div>    
            <telerik:RadContextMenu ID="RadContextMenu1" runat="server" OnClientItemClicking="onClicking">     
            <Targets>    
                <telerik:ContextMenuDocumentTarget />    
            </Targets>    
            <Items>    
                <telerik:RadMenuItem Text="Documents">     
                    <Items>    
                        <telerik:RadMenuItem Text="Item 1" NavigateUrl="documents/Sample/Sample%20Lease%20Document%202008.pdf">     
                        </telerik:RadMenuItem>    
                        <telerik:RadMenuItem Text="Item 2">     
                        </telerik:RadMenuItem>    
                    </Items>    
                </telerik:RadMenuItem>    
            </Items>    
            </telerik:RadContextMenu>        
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server">     
            </telerik:RadWindowManager>    
        </div>    
        </form>    
    </body>    
    </html>    
        
     
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 Apr 2009 Link to this post

    Hello Jorge,

    Can you try radopen() method for opening RadWindow instead of using oManager.open(). Give a try with following code and see whether it helps.

    [JavaScript]
      
    <script language="javascript" type="text/javascript">  
    function onClicking(sender, eventArgs)   
    {    
        var item = eventArgs.get_item();   
        var navigateUrl = item.get_navigateUrl();  
        eventArgs.set_cancel(true);  
        if (navigateUrl && navigateUrl != "#")   
        {    
            var oWnd  = radopen(navigateUrl, "document");  
        }    
    }  
    </script> 

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. jorge
    jorge avatar
    23 posts
    Member since:
    Apr 2007

    Posted 21 Apr 2009 Link to this post

    Shinu,

    No difference.  Some additional information, the menu remains open, and if you continue through the error, it will generate the error again if the cursor hovers over the window.

    Jorge
  5. Answer
    Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 22 Apr 2009 Link to this post

    Hi Jorge,

    You can use the approach that Shinu provided. Then you need to use a different name of the RadWindow, because you are currently using a name of one of the system variables - document. Could you please rename the mentioned property?

    For example :

    var oWnd  = radopen(navigateUrl, "MyDocument"); 

    I hope this helps.

    Kind regards,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. jorge
    jorge avatar
    23 posts
    Member since:
    Apr 2007

    Posted 22 Apr 2009 Link to this post

    Thank you.  Changing the window name did the trick.  I was still able to use the window manager.

    Now the problem is that the context menu remains open.  What do I need to do to make it close once the radwindow is opened?

    Jorge
  7. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Apr 2009 Link to this post

    Hello Jorge,

    Try the hide() method in order to hide the contextmenu once clicked the menuitem.

    JavaScript:
     
    <script language="javascript" type="text/javascript"
    function onClicking(sender, eventArgs)  
    {   
        var item = eventArgs.get_item();  
        var navigateUrl = item.get_navigateUrl(); 
        eventArgs.set_cancel(true); 
        if (navigateUrl && navigateUrl != "#")  
        {   
            var oWnd  = radopen (navigateUrl, "WindowName"); 
        } 
        sender.hide(); 
    </script>  

    -Shinu
  8. jorge
    jorge avatar
    23 posts
    Member since:
    Apr 2007

    Posted 23 Apr 2009 Link to this post

    Thanks for all the help.  Calling the hide() method on the menu itself did the trick.  I had tried using close() but that had not worked.

    Jorge
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017