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

Selected tab from tabstrip

1 Answer 124 Views
Tabstrip (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rekha Kardam
Top achievements
Rank 1
Rekha Kardam asked on 23 Dec 2009, 04:20 AM
Hi

I have a usercontrol in master page,in this usercontrol ,i have placed tab strip,onclick of tab strip ,i am redirecting to another page.

Page is redirecting to another page but ,that tab is not getting selected,please haelp me out,
i am attaching the source code of that user control :

 

Source code (ascx)  
====================  
 <table class="planTabTable" width="100%" >  
        <tr>  
            <td colspan="5">  
            <rad:RadTabStrip ID="PlanTabs" runat="server" Skin="Office2007" AutoPostBack="True" SelectedIndex="0" ClickSelectedTab="True">  
                <Tabs>  
                    <rad:Tab ID="Tab1" runat="server"  Text="Summary"   >  
                    </rad:Tab>  
                    <rad:Tab ID="Tab2" runat="server"  Text="Room Revenue"   >  
                    </rad:Tab>  
                    <rad:Tab ID="Tab3" runat="server"  Text="Line Items" >  
                    </rad:Tab>  
                    <rad:Tab ID="Tab4" runat="server"  Text="Audit">  
                    </rad:Tab>  
                </Tabs>  
            </rad:RadTabStrip>  
        </td>  
    </tr>  
</table>  
 
Code behind (ascx.vb)  
=====================  
Imports PortfolioOne.Common  
 
<Serializable()> _  
Partial Public Class PlanTabControlHeader_NEW  
    Inherits P1BaseUserControl
#Region "Properties"  
 
    ' these get rendered on the page to set the css class for each tab  
    ' they get set in PreRender  
    Protected _roomRevenueTabClass As String = "planTabUnactive" 
    Protected _lineItemsTabClass As String = "planTabUnactive" 
    Protected _summaryTabClass As String = "planTabUnactive" 
    Protected _auditTabClass As String = "planTabUnactive" 
    Private _tabQueryString As String = "" 
    Private _activeTab As PlanTabSelection = PlanTabSelection.RoomRevenue  
 
    Public Property TabQueryString() As String 
        ''' <summary>  
        ''' The params that the tab control should put in the links of the tabs.  
        ''' Do not include the leading '?'.  
        ''' </summary>  
        Get 
            Return _tabQueryString  
        End Get 
        Set(ByVal value As String)  
            _tabQueryString = value  
        End Set 
    End Property 
 
    Public Property ActiveTab() As PlanTabSelection  
        ''' <summary>  
        ''' Sets the active tab shown on the control.  
        ''' </summary>  
        Get 
            Return _activeTab  
        End Get 
        Set(ByVal value As PlanTabSelection)  
            _activeTab = value  
        End Set 
    End Property
#End Region  
 
#Region "Events" 
 
    ' we'll fire this event when a tab is clicked so the pages can listen for it  
    Public Event TabClicked As CommandEventHandler  
 
    Protected Overrides Sub Page_Init(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Init  
        MyBase.Page_Init(sender, e)  
    End Sub 
 
    Private Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
        If Not Me.IsPostBack Then 
            If Me.Parent.FindControl("hdnEditVersionGUID"Is Nothing Then 
                Me.GUIDPlanVersionID.Value = Request.QueryString("GUID").ToString()  
            Else 
                Me.GUIDPlanVersionID.Value = DirectCast(Me.Parent.FindControl("hdnEditVersionGUID"), HtmlInputHidden).Value  
            End If 
 
 
 
            'If Me.Parent.FindControl("hdnCompareVersionGUID") Is Nothing Then  
            '    Me.GUIDComparePlanVersionID.Value = Request.QueryString("CompareGUID").ToString()  
            'Else  
            '    Me.GUIDComparePlanVersionID.Value = DirectCast(Me.Parent.FindControl("hdnCompareVersionGUID"), HtmlInputHidden).Value  
            'End If  
 
 
        End If 
    End Sub ' Page_Load  
 
    Private Sub Page_PreRender(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.PreRender  
 
        Try 
            Dim intTabIndex As Integer 
            If Session("LastClick") IsNot Nothing Then 
                intTabIndex = CInt(Session("LastClick").ToString())  
            Else 
                intTabIndex = 0  
            End If 
 
            Dim oTab As Telerik.WebControls.Tab = PlanTabs.Tabs(intTabIndex)  
            If Not oTab Is Nothing Then 
                oTab.BackColor = Drawing.Color.Honeydew  
                oTab.ForeColor = Drawing.Color.Blue  
                oTab.SelectParents()  
            End If 
 
        Catch ex As Exception  
            Call Alloso.PortfolioOne.Common.WriteToEventLog(System.Reflection.MethodBase.GetCurrentMethod.Name, Err.Number, ex.ToString(), EventLogEntryType.ErrorMe.MyUser.UserName)  
 
        End Try 
 
    End Sub ' Page_PreRender  
 
    Protected Sub PlanTabs_TabClick(ByVal sender As System.ObjectByVal e As Telerik.WebControls.TabStripEventArgs) Handles PlanTabs.TabClick  
 
        Try 
 
            Select Case e.Tab.Text  
                Case "Summary" 
                    Session("LastClick") = 0  
                    RaiseEvent TabClicked(MeNew CommandEventArgs("PlanTabClicked", PlanTabSelection.Summary))  
                    Response.Redirect("PlanSummary_NEW.aspx?" & _tabQueryString & "GUID=" & Me.GUIDPlanVersionID.Value, True)  
 
                Case "Room Revenue" 
                    Session("LastClick") = 1  
                    RaiseEvent TabClicked(MeNew CommandEventArgs("PlanTabClicked", PlanTabSelection.RoomRevenue))  
                    Response.Redirect("PlanRevenue_NEW.aspx?" & _tabQueryString & "GUID=" & Me.GUIDPlanVersionID.Value, True)  
 
                Case "Line Items" 
                    Session("LastClick") = 2  
                    RaiseEvent TabClicked(MeNew CommandEventArgs("PlanTabClicked", PlanTabSelection.LineItems))  
                    Response.Redirect("PlanExpenses_NEW.aspx?" & _tabQueryString & "GUID=" & Me.GUIDPlanVersionID.Value, True)  
                Case Else 
                    Session("LastClick") = 3  
                    ' else assume audit  
                    RaiseEvent TabClicked(MeNew CommandEventArgs("PlanTabClicked", PlanTabSelection.Audit))  
                    Response.Redirect("PlanAudit_NEW.aspx?" & _tabQueryString & "GUID=" & Me.GUIDPlanVersionID.Value, True)  
            End Select 
 
            PlanTabs.SelectedTab.BackColor = Drawing.Color.Blue  
 
        Catch ex As Exception  
            If Err.Number <> 5 Then Call Alloso.PortfolioOne.Common.WriteToEventLog(System.Reflection.MethodBase.GetCurrentMethod.Name, Err.Number, ex.ToString(), EventLogEntryType.ErrorMe.MyUser.UserName)  
 
        End Try 
 
    End Sub 
 
    Private Sub PlanTabs_TabSelected(ByVal sender As ObjectByVal args As Telerik.WebControls.TabStripEventArgs)  
 
    End Sub
#End Region  
 
End Class 

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 28 Dec 2009, 09:50 AM
Hi Rekha Kardam,

Please check this demo on how to achieve this: TabStrip > Site Navigation

All the best,
Veskoni
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Tabstrip (obsolete as of Q2 2010)
Asked by
Rekha Kardam
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or