Find TabStrip Server Side

2 posts, 0 answers
  1. Najid Hanif
    Najid Hanif avatar
    92 posts
    Member since:
    Jul 2011

    Posted 24 Aug 2012 Link to this post

    I can't seem to find my Tabstrip from Code behind. here is my setup:

    Codebehind where I try and find tabstrip is loaded from a usercontrol in a multipage

    RadTabStrip tabstrip = (RadTabStrip)Page.Master.FindControl("RadTabStrip1"); //This returns null
    RadTab SelectedTab = tabstrip.Tabs.FindTabByText("Testers"); //and blows up at this line

     Tabstrip , ajax loading panel, and multipage  is setup like this:
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" SelectedIndex="0" MultiPageID="RadMultiPage2" OnClientTabSelecting="onTabSelecting" OnTabClick="RadTabStrip1_TabClick"></telerik:RadTabStrip>
           <script type="text/javascript">
               function onTabSelecting(sender, args) {
                   if (args.get_tab().get_pageViewID()) {
    <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1">
       <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
               <telerik:AjaxSetting AjaxControlID="RadTabStrip1">
                       <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                       <telerik:AjaxUpdatedControl ControlID="RadMultiPage2" LoadingPanelID="LoadingPanel1" />
               <telerik:AjaxSetting AjaxControlID="RadMultiPage2">
                       <telerik:AjaxUpdatedControl ControlID="RadMultiPage2" LoadingPanelID="LoadingPanel1" />
       <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="Office2010Blue"></telerik:RadSkinManager>
       <telerik:RadProgressManager ID="RadProgressManager1" Runat="server"/>
         <telerik:RadMultiPage ID="RadMultiPage2" runat="server" SelectedIndex="0" OnPageViewCreated="RadMultiPage1_PageViewCreated"></telerik:RadMultiPage>

    Any ideas? 

  2. Nencho
    Nencho avatar
    1665 posts

    Posted 27 Aug 2012 Link to this post

    Hi Najid,

    You could use the FindControl method  on the ContentPlaceHolder which hosts the user control with the RadTabStrip and the RadMultiPage. Please consider the following implementation:

    protected void Page_Load(object sender, EventArgs e)
             RadTabStrip tabstrip = (RadTabStrip)ContentPlaceHolder1.FindControl("RadTabStrip1");
             RadTab SelectedTab = tabstrip.Tabs.FindTabByText("Testers");

    In the example given the ContentPlaceHolder1 is the PlaceHolder, used to load the UserControl

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top