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

Get dataitem in tabselected event

1 Answer 37 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Naresh
Top achievements
Rank 1
Naresh asked on 11 Jul 2011, 05:17 AM
Hi,
I use entity datasource for the tabstrip, but in the TabSelected event, the dataItem for the selected tab is 'nothing'. (I use templates for tabs)

How to get the dataitem in the 'tabselected' event

ex:

    Protected Sub TabSelected(ByVal sender As Object, ByVal e As RadTabStripEventArgs)
        Me.uxTabStrip.SelectedIndex = e.Tab.Index
        Dim entity= TryCast(e.Tab.DataItem, entity)
    End Sub

##  entity is 'Nothing' here 

regards,
Naresh

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 13 Jul 2011, 08:30 AM
Hi Naresh,

The reason for the experienced behavior is due to the fact that the DataItem is only available when biding the RadTabStrip.It is not persisted across post-backs in order to optimize the performance. This means that you could access it in TabDataBound event for instance. If you want to persist some values from the DataItem you should bind them as custom attributes to your Tabs.

Greetings,
Dimitar Terziev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
TabStrip
Asked by
Naresh
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or