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

Question about selected tab in formview

5 Answers 80 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 24 Jun 2010, 04:10 PM
I've set up a tabstrip in the pager template of a formview and bound it to a SQLDatasource.  I then set up a server side OnTabClick event to change the page of the formview.  This works great.  The only issue I'm having is displaying the selected tab.  It seems to only work if I click the same tab twice.  I've tried setting the selected tab in the tabclick event and in the page_load event to to avail.  Does anyone have any ideas?
 
Here is my code, including the tab.selected property in the event.  The functionality is the same with or without that line.

<telerik:RadTabStrip ID="RadTabStrip2" runat="server" 
     DataSourceID="SqlDataSource5" DataTextField="proj_no" 
     ontabclick="RadTabStrip2_TabClick">  
</telerik:RadTabStrip> 
 
    Protected Sub RadTabStrip2_TabClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTabStripEventArgs)  
        FormView3.PageIndex = e.Tab.Index  
        e.Tab.Selected = True 
    End Sub 


Thanks.

5 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 25 Jun 2010, 02:36 PM
Hello Brian,

Actually the tab should be selected when clicked without manually setting its Selected property.  Can you send us a simple page so that we can investigate the reasons for this issue? You should open a support ticket and send us the file there. Thanks.

Best wishes,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Brian
Top achievements
Rank 1
answered on 25 Jun 2010, 08:39 PM
Thanks.  Entered ticket 322652.
0
Yana
Telerik team
answered on 28 Jun 2010, 09:38 AM
Hello Brian,

Thank you, I'll review the ticket.

Kind regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Patrick Stovall
Top achievements
Rank 1
answered on 22 Jul 2010, 03:10 PM
Has there been a resolution to this?

I am also having issues of having to click a tab twice to get it to work. 

Thanks.
0
Brian
Top achievements
Rank 1
answered on 22 Jul 2010, 03:30 PM

Got the following from Telerik.

The problem is that when the page index is changed, the tabstrip is rebinded and loses its selected index. I suggest you save it manually in the viewstate and set it in DataBound event. I've attached the modified page to demonstrate the approach (I use different datasource).

Greetings,
Yana
the Telerik team

Here's some of the code he sent.

Imports System.Data
Imports Telerik.Web.UI
  
Partial Class masteroverviewVB
    Inherits System.Web.UI.Page
  
  
    Protected Sub masteroverview_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            If FormView3.TopPagerRow IsNot Nothing Then
                Dim thisTabStrip As RadTabStrip = TryCast(FormView3.TopPagerRow.FindControl("RadTabStrip2"), RadTabStrip)
                If thisTabStrip IsNot Nothing Then
                    thisTabStrip.SelectedIndex = 0
                End If
            End If
        End If
  
    End Sub
  
    Protected Sub RadTabStrip2_TabClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTabStripEventArgs)
        FormView3.PageIndex = e.Tab.Index
        ViewState("selectedTab") = e.Tab.Index
  
    End Sub
  
    Protected Sub RadTabStrip2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)
        TryCast(sender, RadTabStrip).SelectedIndex = ViewState("selectedTab")
  
    End Sub
End Class
Tags
TabStrip
Asked by
Brian
Top achievements
Rank 1
Answers by
Yana
Telerik team
Brian
Top achievements
Rank 1
Patrick Stovall
Top achievements
Rank 1
Share this question
or