Telerik Radtabstrip自动高度

本文关键字:高度 Radtabstrip Telerik | 更新日期: 2023-09-27 17:54:22

如何设置teleerik radtabstrip Height为auto. .

我想增加标签的高度随着内容的大小增加。我不想要滚动条。我已经搜索过了,但是它只需要固定大小

Telerik Radtabstrip自动高度

如果你谈论的是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的文档