item.open not working

2 posts, 0 answers
  1. Sean
    Sean avatar
    11 posts
    Member since:
    Oct 2008

    Posted 06 Feb 2009 Link to this post

    I'm using the latest asp radcontrols and trying to open a menu item up by default when the page displays.  I'm using the following js sample code from this site:

     

    function openMenu() {

     

      var menu = $find("<%= MainMenu.ClientID %>");

     

      var item = menu.findItemByText("Invoices");

      item.open();

     

    }

    but VS2008 stops at item.open() and says the method doesn't exist.  I can inspect item, see that it's not null, it has a value and see a method list which includes stuff like focus, expand, show, etc but it's right, there's no open method in the list.

    Any idea what's wrong?  I found a few different samples on the site but they all call item.open.

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Feb 2009 Link to this post

    Hello Sean,

    I tried the code in my end and its working fine for me. I am not sure about the issue at your side. I called the openMenu() function from client side pageLoad(). Try calling the openMenu() from pageLoad and see whether its working fine for you.

    JavaScript:
    <script type="text/javascript"
    function pageLoad() 
        openMenu(); 
     
    function openMenu() 
        var menu = $find("<%= MainMenu.ClientID %>"); 
        var item = menu.findItemByText("Invoices"); 
        item.open(); 
    </script> 

    Thanks,
    Shinu.
Back to Top