Edit Radtab

8 posts, 0 answers
  1. Karl Ranville
    Karl Ranville avatar
    28 posts
    Member since:
    Mar 2013

    Posted 23 May 2013 Link to this post

    Hi,

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

    Thanks,
    Karl.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 May 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Karl Ranville
    Karl Ranville avatar
    28 posts
    Member since:
    Mar 2013

    Posted 05 Jun 2013 Link to this post

    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.
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 05 Jun 2013 Link to this post

    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.
  6. Karl Ranville
    Karl Ranville avatar
    28 posts
    Member since:
    Mar 2013

    Posted 24 Jul 2013 Link to this post

    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?
  7. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 24 Jul 2013 Link to this post

    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.
  8. Karl Ranville
    Karl Ranville avatar
    28 posts
    Member since:
    Mar 2013

    Posted 13 Aug 2013 Link to this post

    Hi shinu,

    Using css how can I add a custom style to the tab text on selecting tab?
  9. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Aug 2013 Link to this post

    Hi Karl,

    Try overriding the default CSS as follows.

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

    Thanks,
    Shinu.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017