Select Tab client side on PageLoad

5 posts, 1 answers
  1. Markus
    Markus avatar
    196 posts
    Member since:
    Dec 2007

    Posted 23 Apr 2008 Link to this post

    I want to select a particular tab (together with the multipage) on PageLoad on client side. Selecting the tab is no problem but I failed to get a reference to the radMultiPage to also select the correct PageView. On page load or TabOnLoad it seems that the control is not available the "$find" returns "null". When I select a tab by mouse the reference is available but there it is to late. Any ideas how to accomplish this task?
  2. Answer
    Paul
    Admin
    Paul avatar
    4281 posts

    Posted 23 Apr 2008 Link to this post

    Hello Markus,

    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">  
        </asp:ScriptManager> 
     
        <script type="text/javascript">  
        function pageLoad()  
        {  
            var myTabStrip = $find("<%= RadTabStrip1.ClientID %>")             
            var tab = myTabStrip.findTabByText("Root RadTab2");  
            tab.select();              
        }  
        </script> 
     
        <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1">  
            <Tabs> 
                <telerik:RadTab runat="server" Text="Root RadTab1">  
                </telerik:RadTab> 
                <telerik:RadTab runat="server" Text="Root RadTab2">  
                </telerik:RadTab> 
            </Tabs> 
        </telerik:RadTabStrip> 
        <telerik:RadMultiPage ID="RadMultiPage1" runat="server">  
            <telerik:RadPageView ID="RadPageView1" runat="server">  
                RadPageView1</telerik:RadPageView> 
            <telerik:RadPageView ID="RadPageView2" runat="server">  
                RadPageView2</telerik:RadPageView> 
        </telerik:RadMultiPage> 
    </form> 


    Sincerely yours,
    Paul
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Markus
    Markus avatar
    196 posts
    Member since:
    Dec 2007

    Posted 24 Apr 2008 Link to this post

    Hello Paul,

    thanks for help in this way it is working!

    The client "pageLoad" will be executed when page is ready loaded. Is there also an event availble when page starts with loading?

    Regards Markus
  4. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 24 Apr 2008 Link to this post

    Hi Markus,

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

    All the best,
    Paul
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Markus
    Markus avatar
    196 posts
    Member since:
    Dec 2007

    Posted 24 Apr 2008 Link to this post

    Thanks for information!
Back to Top