1

如何将 Telerik radtabstrip 高度设置为自动。.

我想随着内容大小的增加而增加选项卡的高度。我不想要滚动条。我已经搜索过,但它只需要固定大小

4

1 回答 1

1

如果您在谈论 PageView 的高度:

ASPX:

<telerik:radtabstrip id="RadTabStrip1" runat="server" selectedindex="0" multipageid="RadMultipage1"> 
        <Tabs>
            <telerik:RadTab Text="Tab1" PageViewID=" RadMultipage1">
            </telerik:RadTab>
            <telerik:RadTab Text="Tab2">
            </telerik:RadTab>
            <telerik:RadTab Text="Tab3">
            </telerik:RadTab>
        </Tabs>
    </telerik:radtabstrip>
<telerik:radmultipage id="RadMultipage1" runat="server" selectedindex="0"> 
        <telerik:RadPageView runat="server" ID="RadPageView1" ContentUrl="Default2.aspx" /> 
    </telerik:radmultipage>

JavaScript:

<script type="text/javascript">

function resize() {
    var height = getDocHeight();
    var elements = window.top.document.getElementsByTagName("div");    

    for (var i = 0; i < elements.length; i++) {
        var containerPageViewID = "RadPageView1";

        if (elements[i].id.indexOf(containerPageViewID) > -1) {
            elements[i].style.height = height + "px";
            break;
        }
    }
}

if (window.addEventListener)
    window.addEventListener("load", resize, false);
else if (window.attachEvent)
    window.attachEvent("onload", resize);
else window.onload = resize;

function getDocHeight() {
    var D = document;
    return  Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}

</script>

资料来源:Telerik 的文档

于 2013-01-17T17:58:36.230 回答