Assign ID to Individual Tabs?

2 posts, 0 answers
  1. Kelly
    Kelly avatar
    1 posts
    Member since:
    Jul 2010

    Posted 06 Jul 2010 Link to this post

    I'd like to assign a unique id to each tab within the tabstrip but it appears this is a read only attribute.  I'm using my own css and I'd like to assign a dynamic css class to each tab depending on a number of variables.

    Utilizing the FindTabByValue doesn't won't work for what I'm trying to do since I need to assign a new css background based on the id of the entire tab, not just the anchor or span tag within that tab. 

    Has anyone been able to do this?
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 12 Jul 2010 Link to this post

    Hi Kelly,

    I am not quite sure what your goal is, but if you need to set a css class on the 'li' element of the tab, you can use jQuery. For example, try the following code, view what is rendered on the client and let me know if this is what you need:
    <script type="text/javascript">
           function pageLoad() {
               var tabstrip = $find('<%=RadTabStrip1.ClientID %>');
               $telerik.$(tabstrip.findTabByValue('this').get_element()).addClass("CustomClassForLI");
           }
       </script>
       <telerik:RadTabStrip ID="RadTabStrip1" runat="server">
           <Tabs>
               <telerik:RadTab runat="server" Text="Root RadTab1">
               </telerik:RadTab>
               <telerik:RadTab runat="server" CssClass="CustomClassForLink" Value="this" Text="Root RadTab2">
               </telerik:RadTab>
               <telerik:RadTab runat="server" Text="Root RadTab3">
               </telerik:RadTab>
           </Tabs>
       </telerik:RadTabStrip>


    Greetings,
    Peter
    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
Back to Top