How ASP.NET page and Telerik Controls are loaded, separate thread or something else?

3 posts, 1 answers
  1. Mike
    Mike avatar
    24 posts
    Member since:
    Feb 2008

    Posted 22 Jan 2010 Link to this post


    I have faced a problem that occurs many times when I use Javascript to handle Telerik Controls in ASP.NET page.
    For example if my ASP.NET page's Page_load method is trying to invoke Telerik component, let's say RadTabStrip using Javascript
    code like $find("radTabStrip1.ClientID") will return null and the whole script fails.

    So, when putting Javascript code with setTimeout it doen't. Code like below will usually work.

     function SelectTab(index) {
          function Set() {
           var radTabStrip1 = $find("<%=RadTabStrip1.ClientID %>");
          setTimeout(Set, 1000);

    So, my question is that how ASP.NET page and  Telerik Components are actually loaded?
    Are they running in separate parallel Threads or how? Can I do something else than putting Javascript code
    into setTimeOut? setTimeOut sounds a little bit wierd.

    I have faced this problem sometimes with pure ASP.NET/Telerik Applications but very often if ASP.NET/Telerik Application is running under SharePoint.


  2. Answer
    Poul Henningsen
    Poul Henningsen avatar
    194 posts
    Member since:
    May 2006

    Posted 22 Jan 2010 Link to this post

    Any JavaScript function named pageLoad() will automatically wireup as an Application.Load handler (basically, the client-side version of Page_Load).

    Here's a sample code snippet that shows the needed approach.

    <form id="form1" runat="server">   
        <asp:ScriptManager ID="ScriptManager1" runat="server">   
        <script type="text/javascript">   
        function pageLoad()   
            var myTabStrip = $find("<%= RadTabStrip1.ClientID %>")              
            var tab = myTabStrip.findTabByText("Root RadTab2");   
        <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1">   
                <telerik:RadTab runat="server" Text="Root RadTab1">   
                <telerik:RadTab runat="server" Text="Root RadTab2">   
        <telerik:RadMultiPage ID="RadMultiPage1" runat="server">   
            <telerik:RadPageView ID="RadPageView1" runat="server">   
            <telerik:RadPageView ID="RadPageView2" runat="server">   

    pageLoad is a shortcut for the Sys.Application.load event. For details on the matter please refer to the following ASP.NET article.

  3. Mike
    Mike avatar
    24 posts
    Member since:
    Feb 2008

    Posted 23 Jan 2010 Link to this post

    Thanks for your reply Poul!

Back to Top