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

How to set CssClass to rtsLI or LI tag

2 Answers 61 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Mohammed Nadeem
Top achievements
Rank 1
Mohammed Nadeem asked on 26 Oct 2008, 08:38 PM
1. Following Code is generated by RadTabStrip
2. When i apply CssClass "test" (see yellow highlighted rows)
3. The class is applied to <a> tag instead of <li> tag
4. How do I apply CssClass to <li class="rtsLI"> tag

<telerik:RadTab runat="server" IsSeparator="True" PostBack="False" CssClass="empty">

            </telerik:RadTab>

            <telerik:RadTab runat="server" Text="sel" CssClass="test">

            </telerik:RadTab>

            <telerik:RadTab runat="server" IsSeparator="True" PostBack="False" CssClass="seperator">

            </telerik:RadTab>

            <telerik:RadTab runat="server" SelectedCssClass="sel" Text="My Worklist">

            </telerik:RadTab>

            <telerik:RadTab runat="server" IsSeparator="True" PostBack="False" CssClass="seperator">

            </telerik:RadTab>

            <telerik:RadTab runat="server" SelectedCssClass="sel" Text="View All">

            </telerik:RadTab>


2 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 05 Nov 2008, 09:40 AM
Hi Mohammed Nadeem,

Unfortunately, currently there is no way in setting the CSS class of these elements through the back-end code. Your only option for the time being is to set them through the CssClass property and delegate them with the following javascript:
Sys.Application.add_load (function () {
    var callback = function (item) {

        var cssClass = item.get_cssClass();
       
        if (cssClass) {
            item.get_element().className += " " + cssClass;
        }
    };

    (function iterateTreeView (root) {
   
        var treeNodes = root.get_nodes();
       
        var item, textElement;
       
        for (var i = 0, len = treeNodes.get_count(); i < len; i++) {
       
            item = treeNodes.getItem(i);
           
            callback(item);
           
            if (item._hasChildren()) {
                iterateTreeView(item);
            }
        }
    }) ($find('<%= RadTreeView1.ClientID %>'));
});

This problem will be addressed soon by introducing a new property (e.g. ContentCssClass) with the first service pack of the Q3.2008 release. We are sorry about the inconvenience.

All the best,
Alex
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mohammed Nadeem
Top achievements
Rank 1
answered on 05 Nov 2008, 06:44 PM
Hi Alex

Thanks for confirming that in this release it is not possible from server side code.

I gave up after spending a whole day to make this thing work but unfortunately did not have any success.

Finally, i had to create a custom skin in order to achieve.

Anyways thanks for the information, and will try to see how the javascript code goes.

Cheers
Mohammed Nadeem




Tags
TabStrip
Asked by
Mohammed Nadeem
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Mohammed Nadeem
Top achievements
Rank 1
Share this question
or