RadMenu $find not working

2 posts, 0 answers
  1. Gibson Wong
    Gibson Wong avatar
    8 posts
    Member since:
    Nov 2007

    Posted 30 Jun 2010 Link to this post

    UPDATE: I've found the problem.
    I can't $find the RadMenu control until page is done rendering. 
    ================================================================
    Hello, I'm having trouble with using $find in client-side javascript to get a reference of a RadMenu
    $find returns null while $get returns an object.
    However, the object $get returned doesn't support .findItemByValue() method.
    I'm using Q1 2010 Net4 version with VS2010 and web.config set to .NET 4.

    I've also tried $find("RadMenu1");

    What kind of dependencies are there for RadMenu? web.config settings?
    Thanks.
    Gibson

    See code below:

    var menu = $find("RadMenu1"); 
    var item = menu.findItemByText("Message Center"); 
     
  2. Krsnaraja
    Krsnaraja avatar
    9 posts
    Member since:
    Aug 2007

    Posted 01 Jul 2010 Link to this post

    The $get is shorthand for the document.getElementById and element.getElementById functions. The $find is shortcut function for Sys.Application.findComponent which allows you to look up an ASP.NET AJAX client side Component. So basically you need to use $find to get reference to RadMenu client side Component.

    The $find is useful only when all client script has been loaded and initialized. Typically you can write a global function named pageLoad (see below code snippet) or you can explicitly subscribe to the load event of the Application class for client side initialization.

    <script type="text/javascript">         
        function pageLoad() {     
           // Initialization code here, meant to run once.      
           // Note: Unsuitable if used with UpdatePanels.     
            var menu = $find("RadMenu1");     
            var item = menu.findItemByText("Message Center");     
        }      
    </script>    
     


    Regards,
    Krishna

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