Cannot get RadProgressArea object on page load - javascript

Thread is closed for posting
3 posts, 0 answers
  1. Seth
    Seth avatar
    90 posts
    Member since:
    Jun 2007

    Posted 26 Mar 2008 Link to this post

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestPage.aspx.vb" Inherits="TestPage" %> 
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <!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>Untitled Page</title> 
    </head> 
    <body topmargin="0" leftmargin="0" onload="Show()">  
        <form id="form1" runat="server">  
        <div> 
            <input type="button" value="Test" onclick="Show()" /> 
          
            <telerik:RadScriptManager ID="rsmItemViewer" runat="server" EnablePageMethods="True">  
            </telerik:RadScriptManager> 
     
            <telerik:RadProgressArea ID="RadProgressArea1" runat="server">  
            </telerik:RadProgressArea> 
            <telerik:RadProgressManager ID="RadProgressManager1" runat="server" /> 
     
            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
            <script type="text/javascript" language="javascript">  
                function Show()  
                {  
                    var oProgArea = $find('<%= RadProgressArea1.ClientID %>');  
                    alert(oProgArea);  
                    oProgArea.show();  
                }  
            </script> 
            </telerik:RadCodeBlock> 
        </div> 
        </form> 
    </body> 
    </html> 

    The preceding code shows that I am attempting to display the RadProgressArea on page load.  The Show() function is called onLoad of the page and also from a input button click.  oProgArea is found to be null when called from the onLoad body event and works as expected when called from the input button click.

    What am I doing wrong here?

    Seth
  2. Sophy
    Admin
    Sophy avatar
    636 posts

    Posted 27 Mar 2008 Link to this post

    Hello Seth,

    All Telerik's Prometheus controls are based on the ASP.NET Ajax Framework. The problem you experience is due to the fact the at body load event the RadProgressArea has still not been created. The moment at which all scripts have been loaded and all objects in the application that are created by using $create are initialized is the Application Load event. For more information you can refer to the ASP.NET AJAX Client Life-Cycle Events article 

    If you want to show RadProgressArea at page load I suggest you the following code:

    <body topmargin="0" leftmargin="0">     
        <form id="form1" runat="server">     
        <div>    
            <input type="button" value="Test" onclick="Show()" />    
            <asp:scriptmanager id="ScriptManager1" runat="server">  
            </asp:scriptmanager>   
            <script type="text/javascript">  
            function pageLoad()  
            {  
                Show();  
            }  
            </script> 
              
            <telerik:RadProgressArea ID="RadProgressArea1" runat="server">     
            </telerik:RadProgressArea>    
            <telerik:RadProgressManager ID="RadProgressManager1" runat="server" />    
        
            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">     
            <script type="text/javascript" language="javascript">     
                function Show()     
                {     
                    var oProgArea = $find('<%= RadProgressArea1.ClientID %>');     
                    alert(oProgArea);     
                    oProgArea.show();     
                }     
            </script>    
            </telerik:RadCodeBlock>    
        </div>    
        </form>    
    </body> 

    Please, let us know if you have other questions.

    Best regards,
    Sophy
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Seth
    Seth avatar
    90 posts
    Member since:
    Jun 2007

    Posted 27 Mar 2008 Link to this post

    Solid.

    Thanks.
Back to Top