This is a migrated thread and some comments may be shown as answers.

Cannot get RadProgressArea object on page load - javascript

2 Answers 103 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Seth
Top achievements
Rank 1
Seth asked on 26 Mar 2008, 02:14 PM
<%@ 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 Answers, 1 is accepted

Sort by
0
Sophy
Telerik team
answered on 27 Mar 2008, 01:43 PM
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
0
Seth
Top achievements
Rank 1
answered on 27 Mar 2008, 01:58 PM
Solid.

Thanks.
Tags
Upload (Obsolete)
Asked by
Seth
Top achievements
Rank 1
Answers by
Sophy
Telerik team
Seth
Top achievements
Rank 1
Share this question
or