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

Edit Radtab

7 Answers 97 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Karl Ranville
Top achievements
Rank 1
Karl Ranville asked on 23 May 2013, 01:19 PM
Hi,

Using index how can I access a radtab in js and set a new text and navigation link.

Thanks,
Karl.

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 May 2013, 01:28 PM
Hi,

Please try the following JavaScript.

JavaScript:
tabStrip1.get_tabs()._array[index].set_text("NewText")
tabStrip1.get_tabs()._array[index].set_navigateUrl("New Url")

Thanks,
Shinu.
0
Karl Ranville
Top achievements
Rank 1
answered on 05 Jun 2013, 08:28 AM
Hi Shinu

My master page has a radtabstrip with templates containing an asp image (same image for all tabs). On navigating to another page, from C# code how can I access them and add a new image? Any code would be helpful.

Thanks,
Karl.
0
Shinu
Top achievements
Rank 2
answered on 05 Jun 2013, 10:35 AM
Hi Karl,

Please have a look at the sample code i tried which works fine at my end.

ASPX:
<telerik:RadTabStrip ID="RadTabStrip1" runat="server" Skin="Web20">
    <Tabs>
        <telerik:RadTab runat="server" Text="Smartphones">
            <Tabs>
                <telerik:RadTab runat="server" Text="Samsung" />
                <telerik:RadTab runat="server" Text="HTC" />
            </Tabs>
        </telerik:RadTab>
        <telerik:RadTab runat="server" Text="Cameras">
            <Tabs>
                <telerik:RadTab runat="server" Text="Sony" />
                <telerik:RadTab runat="server" Text="Nikon" />
            </Tabs>
        </telerik:RadTab>
    </Tabs>
    <TabTemplate>
        <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/aud.jpg" />
    </TabTemplate>
</telerik:RadTabStrip>

C#:
protected void Page_Load(object sender, RadTabStripEventArgs e)
{
    RadTabStrip RadTabStrip1 = (RadTabStrip)Master.FindControl("RadTabStrip1");
    for (int i = 0; i < RadTabStrip1.Tabs.Count; i++)
    {
        RadTab tab = RadTabStrip1.Tabs[i];
        Image c = (Image)tab.FindControl("Image1");
        c = (Image)tab.FindControl("Image1");
        c.ImageUrl = "~/Images/clo.jpg";
        for (int j = 0; j < tab.Tabs.Count; j++)
        {
            RadTab child = tab.Tabs[j]; c = (Image)child.FindControl("Image1");
            c.ImageUrl = "~/Images/clo.jpg";
        }
    }
}

Thanks,
Shinu.
0
Karl Ranville
Top achievements
Rank 1
answered on 24 Jul 2013, 09:03 AM
Hi shinu

How can I get the last selected radtab. Suppose there are three radtab. Initially I selected first tab and next I selected the second one. There how can I access the first radtab from client?
0
Shinu
Top achievements
Rank 2
answered on 24 Jul 2013, 10:13 AM
Hi Karl,

You can attach the OnClientTabUnSelected event to your RadTabStrip to achieve the requirement. The OnClientTabUnSelected client event fires before the OnClientTabSelected client event when the selection is changed from one RadTab to another. Please have a look into the following code I tried which works fine at my end.

JavaScript:
<script type="text/javascript">
    var lastselectedtab;
    function OnClientTabSelected(sender, args) {
        if (lastselectedtab != null) {
            //alerting the last selected tab text on selecting a new tab.
            alert("Last Selected Tab : " + lastselectedtab.get_text());
        }
    }
    function OnClientTabUnSelected(sender, args) {
        //Getting the current unselected tab which would be the last selected tab.
        lastselectedtab = args.get_tab();
    }
</script>

Thanks,
Shinu.
0
Karl Ranville
Top achievements
Rank 1
answered on 13 Aug 2013, 11:56 AM
Hi shinu,

Using css how can I add a custom style to the tab text on selecting tab?
0
Shinu
Top achievements
Rank 2
answered on 13 Aug 2013, 12:22 PM
Hi Karl,

Try overriding the default CSS as follows.

CSS:
<style type="text/css">
    .rtsSelected
    {
        color: Red !important;
        font-weight:bold;
    }
</style>

Thanks,
Shinu.
Tags
TabStrip
Asked by
Karl Ranville
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Karl Ranville
Top achievements
Rank 1
Share this question
or