在Kendo Tabstrip中设置单个tabpanel的样式

时间:2014-11-14 16:00:12

标签: kendo-ui kendo-asp.net-mvc kendo-tabstrip

我正在使用Kendo-UI Tabstrip,并希望将类添加到一个特定的tabpanel。这可能吗?在items.Add()部分中使用.SpriteCssClasses似乎只是将类添加到选项卡本身,而不是实际的面板。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:2)

您可以尝试使用ID获取特定面板,因为kendo将根据标签条的名称和标签编号(顺序)添加具有特定ID的div,例如:

@(Html.Kendo().TabStrip()
    .Name("Main")
    .Items(Main =>
    {
        Main.Add()
            .Text("test1 title").Content(@<text>
                test1
            </text>);
        Main.Add()
            .Text("test2 title")
            .Content(@<text>
                test2
            </text>);
    })
)

这将生成以下HTML:

<div class="k-tabstrip-wrapper" style="">
    <div id="Main" class="k-widget k-tabstrip k-header" data-role="tabstrip" tabindex="0" role="tablist" aria-activedescendant="Main_ts_active">
        <ul class="k-reset k-tabstrip-items">
            <li class="k-item k-state-default k-first k-tab-on-top k-state-active" role="tab" aria-controls="Main-1" style="" aria-selected="true">
                <span class="k-loading k-complete"></span>
                <a href="#Main-1" class="k-link">test1 title</a>
            </li>
            <li class="k-item k-state-default k-last" role="tab" aria-controls="Main-2" style="">
                <span class="k-loading k-complete"></span>
                <a href="#Main-2" class="k-link">test2 title</a>
            </li>
        </ul>
        <div id="Main-1" class="k-content k-state-active" role="tabpanel" aria-expanded="true" style="height: auto; overflow: hidden; opacity: 1; display: block;">
            <div style="display: none; position: absolute; opacity: 0.8; background-color: rgb(255, 255, 255); z-index: 1001; width: 33.4px; height: 20px;" class="tata-ajax-loader">
                <div style="background-position: center;background-repeat: no-repeat;height:100%;width:100%;background-color: transparent;" class="tata-ajax-loader-img"></div>
            </div>
            test1
        </div>
        <div id="Main-2" class="k-content" role="tabpanel" aria-expanded="false" style="height: auto; overflow: hidden; opacity: 0; display: none;" aria-hidden="true">
            <div style="display: none; position: absolute; opacity: 0.8; background-color: rgb(255, 255, 255); z-index: 1001; width: 33.4px; height: 20px;" class="tata-ajax-loader">
                <div style="background-position: center;background-repeat: no-repeat;height:100%;width:100%;background-color: transparent;" class="tata-ajax-loader-img"></div>
            </div>
            test2
        </div>
    </div>
</div>

请注意ID为“Main-1”和“Main-2”的div是您理解的实际面板的ID,因此您可以在ID上添加CSS:

#Main-1 {
    background-color: #E3F7A8;
}