Fully qualified name for $find() method

5 posts, 0 answers
  1. dingjing
    dingjing avatar
    43 posts
    Member since:
    Jul 2007

    Posted 04 Apr 2008 Link to this post

    What is the fully qualified name for $find()?

    I can use $find() within other functions without problem. For example,
    function FindCombo(idCombo){ 
        var combo = $find(idCombo); 
        combo.set_text("Here I am!"); 
     

    But if I try to use it at top-level, like this:
    var MyObject = new Object(); 
    MyObject.combo = $find("MyComboId"); 
    I get "$find not defined" error.

    Similar error happens when I try to use shortcut method $get(). I use its fully qualified name (document.getElementById), then it is OK. So I guess if I use $find's full name, it should solve the problem.
  2. Thomas
    Thomas avatar
    143 posts
    Member since:
    Feb 2007

    Posted 04 Apr 2008 Link to this post

    Are you using the ClientID like so:

    function FindCombo(idCombo) 
    {  
        var combo = $find("<%=this.MyCombo.ClientID %>");  
        combo.set_text("Here I am!");  
    }  
     
    or 
     
    var MyObject = new Object();  
    MyObject.combo = $find("<%=this.MyCombo.ClientID %>");  

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. dingjing
    dingjing avatar
    43 posts
    Member since:
    Jul 2007

    Posted 04 Apr 2008 Link to this post

    If I was not using the correct ID, the error would be using null object, not "$find undefined"
  5. Thomas
    Thomas avatar
    143 posts
    Member since:
    Feb 2007

    Posted 04 Apr 2008 Link to this post

    True. Then my guess would be that there is something amiss with the Ajax Extensions configuration. In other words, there is either something missing from the web.config file or the Extensions are not installed etc.
  6. dingjing
    dingjing avatar
    43 posts
    Member since:
    Jul 2007

    Posted 04 Apr 2008 Link to this post

    I got it.

    $find is a shortcut for Sys.Application.findComponent. It can only be used after AJAX library has been loaded.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017