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

Access master page tab

1 Answer 142 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Naresh
Top achievements
Rank 1
Naresh asked on 10 Nov 2014, 08:29 AM
I have radtabstrip created in master page.

<div style="position:relative;left:10px; top:10px;z-index:10000">
      <telerik:RadTabStrip ID="RadTabStrip1" runat="server" OnClientTabSelected="OnClientTabSelected">
            <Tabs>
                <telerik:RadTab ID="tab1" PageViewID="Page1"  runat="server" Text="Inbasket" NavigateUrl="NewInbasket.aspx">
                </telerik:RadTab>
                <telerik:RadTab ID="tab2" PageViewID="Page2" runat="server" Text="Notification" NavigateUrl="Notification.aspx">
                </telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip > 
     </div>

On content page "NewInbasket.aspx" I am able to access "RadTabStrip1" 

var radtabstrip = document.getElementById('<%= Page.Master.FindControl("RadTabStrip1").ClientID %>');  

but not able to access RadTab "tab1" and "tab2" on content page "NewInbasket.aspx".

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 12 Nov 2014, 02:17 PM
Hello Suryakumar,

First, I would like to suggest you to use the Client API, in order to get reference to the control (and the tabs) instead of the approach you attempt to use  - document.getElementById.
In addition, the approach which I can suggest you to use in order to achive the desired functionality is as follows :
  1. Use the MasterPage and a custom function, in order to get a reference to the RadTabStrip and expose it through that function :
    function getTabStrip() {
                var tabStrip = $find("<%= RadTabStrip1.ClientID %>");
                return tabStrip;
            }
  2. In any of the content pages, you can use window.parent.getTabStrip(),in order to get a reference to the RadTabStrip and then access the needed Tab :
    function OnClientClicked() {
               var TabStrip = window.parent.getTabStrip();
               var tab1 = TabStrip.findTabByText("Notification");
               alert(tab1.get_text())
           }

In addition, in the attachment, you could find a simplified runnable project, demonstrating the behavior of the above suggested approach.


Regards,
Nencho
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TabStrip
Asked by
Naresh
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or