programaticly enabling tabs

2 posts, 0 answers
  1. Dave
    Dave avatar
    11 posts
    Member since:
    Dec 2011

    Posted 19 Jan 2012 Link to this post

    Hi,

    I have a sub routine in my code behind  (vb) which fires when an event occurs.  What I want to do is selectively enable and disable 4 tabs in the tab strip and set focus to one tab.

    here is my code
    Private Sub LookupTag(tag As String)
     
        Dim c1 As New RadTabStrip
        Select Case tag
            Case "11000ed97c"           'credit card
                'RadTabStrip1.Tabs(1).Focus()
                c1 = RadTabStrip1.FindControl("RadTabStrip1")
                c1.Tabs(0).Enabled = True
                c1.Tabs(1).Enabled = False
                c1.Tabs(2).Enabled = False
                c1.Tabs(3).Enabled = False
            Case "4d004a7d6f"           'watch
                c1 = RadTabStrip1.FindControl("RadTabStrip1")
                c1.Tabs(0).Enabled = False
                c1.Tabs(1).Enabled = True
                c1.Tabs(2).Enabled = False
                c1.Tabs(3).Enabled = False
            Case "0107ee84cd"           'Key Chain
                c1 = RadTabStrip1.FindControl("RadTabStrip1")
                c1.Tabs(0).Enabled = False
                c1.Tabs(1).Enabled = False
                c1.Tabs(2).Enabled = True
                c1.Tabs(3).Enabled = False
            Case "0107ee8a61"           'disk
                c1 = RadTabStrip1.FindControl("RadTabStrip1")
                c1.Tabs(0).Enabled = False
                c1.Tabs(1).Enabled = False
                c1.Tabs(2).Enabled = False
                c1.Tabs(3).Enabled = True
        End Select
    and here is the asp for the tabstrip
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" Skin="Black" MultiPageID="RadMultiPage1"
        SelectedIndex="0" CssClass="tabStrip" AutoPostBack="True">
        <Tabs>
            <telerik:RadTab Text="Ops">
            </telerik:RadTab>
            <telerik:RadTab Text="Management">
            </telerik:RadTab>
            <telerik:RadTab Text="IT">
            </telerik:RadTab>
            <telerik:RadTab Text="Maintenance">
            </telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>

    Can someone give me a hand?

    Thanks in advance,

    Dave
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 20 Jan 2012 Link to this post

    Hello Dave,

    If you need to have a particular tab enabled and selected at the same time you will need to set both Enable and Selected properties of the tabs to true. Please take a look at the definition of your modified handler below for further reference:
    Private Sub LookupTag(ByVal tag As String)
     
            Dim c1 As New RadTabStrip
            Select Case tag
                Case "11000ed97c"           'credit card
                    'RadTabStrip1.Tabs(1).Focus()
                    c1 = RadTabStrip1
                    c1.Tabs(0).Enabled = True
                    c1.Tabs(1).Enabled = False
                    c1.Tabs(2).Enabled = False
                    c1.Tabs(3).Enabled = False
                Case "4d004a7d6f"           'watch
                    c1 = RadTabStrip1
                    c1.Tabs(0).Enabled = False
                    c1.Tabs(1).Enabled = True
                    c1.Tabs(1).Selected = True
                    c1.Tabs(2).Enabled = False
                    c1.Tabs(3).Enabled = False
                Case "0107ee84cd"           'Key Chain
                    c1 = RadTabStrip1
                    c1.Tabs(0).Enabled = False
                    c1.Tabs(1).Enabled = False
                    c1.Tabs(2).Enabled = True
                           c1.Tabs(2).Selected = True
                    c1.Tabs(3).Enabled = False
                Case "0107ee8a61"           'disk
                    c1 = RadTabStrip1
                    c1.Tabs(0).Enabled = False
                    c1.Tabs(1).Enabled = False
                    c1.Tabs(2).Enabled = False
                    c1.Tabs(3).Enabled = True
                           c1.Tabs(3).Selected = True
            End Select
     
        End Sub

    Kind regards,
    Kate
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top