Get dataitem in tabselected event

2 posts, 0 answers
  1. Naresh
    Naresh avatar
    45 posts
    Member since:
    Jul 2008

    Posted 11 Jul 2011 Link to this post

    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
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 13 Jul 2011 Link to this post

    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!

Back to Top