2012-01-09 72 views
0

問題:我無法在Telerik TopPane中將高度設置爲自動。我最終的默認高度值爲230像素。Telerik TopPane高度自動?

代碼:

<div id="ParentDivElement" style="height: 100%;"> 
     <telerik:RadSplitter ID="MainSplitter" runat="server" Height="100%" Width="100%" 
      Orientation="Horizontal" Skin="Outlook" BorderSize="0"> 
      <telerik:RadPane ID="TopPane" runat="server" Height="auto" MinHeight="0" MaxHeight="0" 
       Scrolling="none" BorderStyle="None" EnableAjaxSkinRendering="False" 
       EnableTheming="False"> 
       <!-- Place the content of the pane here --> 
       <div id="tcp_main"> 
        <div id="tcp_logo"> 
         <image src="images/test/logo.png" alt="logo" /> 
        </div> 
        <div id="tcp_text"> 
         <h1> Hello world </h1> 
        </div> 
       </div> 
      </telerik:RadPane> 
      <telerik:RadSplitBar ID="RadsplitbarTop" runat="server" EnableResize="False" /> 
      <telerik:RadPane ID="MainPane" runat="server" Scrolling="none" MinWidth="500"> 
       <telerik:RadSplitter ID="NestedSplitter" runat="server" Skin="Outlook" LiveResize="true"> 
        <telerik:RadPane ID="LeftPane" runat="server" Width="200" MinWidth="150" MaxWidth="400"> 
         <!-- Place the content of the pane here --> 
        </telerik:RadPane> 
        <telerik:RadSplitBar ID="VerticalSplitBar" runat="server" CollapseMode="Forward" /> 
        <telerik:RadPane ID="ContentPane" runat="server"> 
         <!-- Place the content of the pane here --> 
        </telerik:RadPane> 
       </telerik:RadSplitter> 
      </telerik:RadPane> 
     </telerik:RadSplitter> 
</div> 

條件:如果我height屬性設置爲auto,我得到以下錯誤:

Property value is not valid. 

,如果我點擊細節我得到:

'auto' cannot be parsed as a unit as there are no numeric values in it. Examples of valid unit strings are '1px' and '.5in'. 

問題: 它看起來像Telerik控件中的高度不被接受,什麼做我必須做的最終與汽車或它的等效功能?

注意:我不想在CSS中使用!important。

回答

1

將height屬性設置爲從WebControl.Style繼承的RadPane樣式屬性,樣式屬性與添加到樣式集合OnPreRender中的各個屬性呈現相同。

<telerik:RadPane ID="TopPane" runat="server" 
      Scrolling="none" BorderStyle="None" EnableAjaxSkinRendering="False" 
      EnableTheming="False" Style="height: auto; min-height: 0px;"> 
+0

這不起作用。設置高度時,使用javascript更改窗口大小時高度會調整。但高度不是用css auto設置的,所以功能不同。我想在CSS中具有與「auto」相同的功能。 – NomenNescio 2012-01-09 10:53:53

+0

除非您實現自定義JavaScript,否則無法實現SplitterPane自動移動的效果。我建議的確如你設置overflow屬性滾動一樣,你會看到div展開。 – Lloyd 2012-01-09 10:59:18

+0

我不在乎自動移動分隔欄。我想將寬度設置爲「width:auto;」 – NomenNescio 2012-01-09 11:30:50

1

我知道你提到不想設定什麼作爲!在CSS重要,但對實驗的緣故你試過以下?

CSS:

<style type="text/css"> 
    .AutoHeight 
    { 
     height: auto !important; 
    } 
</style> 

標記:

<telerik:RadPane ID="TopPane" runat="server" ... CssClass="AutoHeight" ...> 

這應該強制高度是汽車。如果這樣做,那麼你可以繼續並使用更新的高度屬性修改您正在使用的Telerik Skin(Outlook)。如果您在皮膚中更新此設置,則不必設置!重要!

雖然RadSplitter控件依賴於RadPane的特定尺寸設置(因此最小/最大高度/寬度等),並且您可能需要考慮只是具有一個常規的<div>元素作爲「頂部面板」,然後僅在下半部分使用RadSplitter。