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

Find TabStrip Server Side

1 Answer 25 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Najid Hanif
Top achievements
Rank 2
Najid Hanif asked on 25 Aug 2012, 03:29 AM
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

C#
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()) {
                   args.get_tab().set_postBack(false);
               }
           }
       </script>
<telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1">
</telerik:RadAjaxLoadingPanel>
   <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
       <AjaxSettings>
           <telerik:AjaxSetting AjaxControlID="RadTabStrip1">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                   <telerik:AjaxUpdatedControl ControlID="RadMultiPage2" LoadingPanelID="LoadingPanel1" />
               </UpdatedControls>
           </telerik:AjaxSetting>
           <telerik:AjaxSetting AjaxControlID="RadMultiPage2">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="RadMultiPage2" LoadingPanelID="LoadingPanel1" />
               </UpdatedControls>
           </telerik:AjaxSetting>
       </AjaxSettings>
   </telerik:RadAjaxManager>
 
   <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="Office2010Blue"></telerik:RadSkinManager>
   <telerik:RadProgressManager ID="RadProgressManager1" Runat="server"/>
 
   <div>
     <br/>
     <telerik:RadMultiPage ID="RadMultiPage2" runat="server" SelectedIndex="0" OnPageViewCreated="RadMultiPage1_PageViewCreated"></telerik:RadMultiPage>
   </div>

Any ideas? 

Thanks

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 27 Aug 2012, 01:47 PM
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,
Nencho
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.
Tags
TabStrip
Asked by
Najid Hanif
Top achievements
Rank 2
Answers by
Nencho
Telerik team
Share this question
or