2013-03-14 86 views
0

我有一個包裹在面板內的中繼器(使用MVC Asp.net)。滾動條出現,但我的桌子似乎是包裝,以適應面板的水平尺寸,而不是溢出通過面板。我的asp.net面板上的水平滾動條不會滾動

滾動條正在顯示,但它什麼也沒有做。

<asp:Panel ID="pnlMultipleBeneficiaries" ScrollBars = "Horizontal" style="overflow:scroll" runat=""server" > 
<div class="section" > 
     <fieldset> 
     <legend class="labels">Added Beneficiaries</legend> 

      <asp:Repeater ID="rptMultipleBeneficiaryDetails" runat="server"> 
       <HeaderTemplate> 
        <table border = 1> 
        <tr> 
         <td class="labels displayInput_noWidth">First Name</td> 
         <td class="labels displayInput_noWidth">Last Name</td> 
         <td class="labels displayInput_noWidth">Status</td> 
         <td class="labels displayInput_noWidth">Birthday</td> 
         <td class="labels displayInput_noWidth">Parent</td> 
         <td class="labels displayInput_noWidth">Street</td> 
         <td class="labels displayInput_noWidth">City</td> 
         <td class="labels displayInput_noWidth">Province</td> 
         <td class="labels displayInput_noWidth">Postcode</td> 
         <td class="labels displayInput_noWidth">Country</td> 
         <td class="labels displayInput_noWidth">Phone Number</td> 
         <td class="labels displayInput_noWidth">HasReplied</td> 
         <td class="labels displayInput_noWidth">Something Else</td> 

        </tr>     
       </HeaderTemplate> 
       <ItemTemplate> 
        <tr> 
         <td><%#DataBinder.Eval(Container.DataItem, "BeneficiaryFirstName")%></td> 
         <td><%#DataBinder.Eval(Container.DataItem, "BeneficiaryLastName")%></td> 
         <td><%#DataBinder.Eval(Container.DataItem, "BeneficiarySin")%></td> 
         <td><%#DateTime.Parse(DataBinder.Eval(Container.DataItem, "BeneficiaryBirthday").ToString()).ToString("MM/dd/yyyy")%></td> 
         <td><%#DataBinder.Eval(Container.DataItem, "Parent")%></td> 
         <td><%#DataBinder.Eval(Container.DataItem, "Street1")%></td> 
         <td><%#DataBinder.Eval(Container.DataItem, "City")%></td> 
         <td><%#DataBinder.Eval(Container.DataItem, "ProvinceAbbreviation")%></td> 
         <td><%#DataBinder.Eval(Container.DataItem, "Postcode")%></td> 
         <td><%#DataBinder.Eval(Container.DataItem, "CountryDescription")%></td> 
         <td><%#DataBinder.Eval(Container.DataItem, "HasReplied")%></td> 
         <td><%#DataBinder.Eval(Container.DataItem, "IsGrantApplicationFormReceived")%></td> 
        </tr> 
       </ItemTemplate> 
       <FooterTemplate> 
        </table> 
       </FooterTemplate> 
      </asp:Repeater>   
     </fieldset> 
      </div> 
    </asp:Panel> 

我曾嘗試在面板中使用style =「overflow:auto」,但它什麼也沒做。幫幫我?

+0

嘗試'風格= 「overfllow:滾動」' – Shouvik 2013-03-14 20:28:26

回答

3

您沒有設置面板的寬度。因此,首先設置面板的寬度,然後爲其分配overflow:scroll屬性。

<asp:Panel ID="pnlMultipleBeneficiaries" ScrollBars = "Horizontal" style="overflow:scroll" runat="server" Width="500px"> 

一兩件事你可以嘗試,你可以修復的<div class="section">寬度和在這個類

.section 
{ 
width:500px; 
overflow-x:auto; 
} 

基本上設置overflow屬性點overflow屬性將當你具有固定寬度工作parentoverflow屬性與他們。

+0

大,是工作! – silvenwolf 2013-03-14 20:47:42

+0

好吧,這是有道理的 - 那麼我可以在課堂上設置overflow-x和overflow-y?我直接嘗試,如:style =「overflow-y」,並且它不被識別 – silvenwolf 2013-03-14 20:53:14

+0

「overflow:y」的條件相同。只需在該類中設置高度,因爲我們已經設置了寬度,然後編寫「overflow-y:auto」。它會工作:) – Sachin 2013-03-14 20:55:23

0

SIS,只要改變overflow:auto;overflow:scroll;

+0

我必須這樣做,並在面板工作的大小相應的表。 PS我是女性... – silvenwolf 2013-03-15 16:32:05

+0

哦,對不起,我會改變它。 – 2013-03-16 18:15:49

+0

哈哈感謝塔庫爾:) – silvenwolf 2013-03-19 14:21:09

0

爲我工作(瀏覽器 - > Chrome操作系統版本59.0.3071.115(正式版本)(64位))以及Internet Explorer的版本11 11.0.9600.18697

用於Kendo Grid,兩者都在工作。

CSS代碼:

.k-grid-content { 
    overflow: scroll; 
} 

.k-grid-content { 
    overflow: auto; 
}