2013-09-27 56 views
0

我有一個網頁,其中包含網格視圖並希望爲其列添加調整大小功能。我設法使用JavaScript,但不能減少列的最大數據長度以外的列的大小。看起來gridview的某些屬性可以防止它們的列寬被縮小到超出最大數據長度。調整ASP.NET GridView的列超出其數據長度

我嘗試使用風格,如

text-overflow: ellipsis; 
overflow:hidden; 
white-space:nowrap; 

,但無法完成它,因爲一旦列大小發生變化,這些只能處理數據的代表性。有人可以給我提供一些指導嗎? 非常感謝。

下面是代碼的一部分...

<asp:MultiView ID="uxMainMultiView" runat="server" ActiveViewIndex="0"> 
<asp:View ID="uxHistoryView" runat="server"> 
    <asp:MultiView ID="uxCaseSearchResultMultiView" runat="server" ActiveViewIndex="0"> 
     <asp:View ID="uxFlatView" runat="server"> 
      <asp:GridView ID="uxCaseSearchGrid" runat="server" BorderWidth="0px" CssClass="grid" 
       Width="100%" OnInit="uxCaseSearchGrid_Init" OnRowDataBound="uxCaseSearchGrid_RowDataBound" 
       AllowPaging="true" AllowSorting="true" OnPageIndexChanging="uxCaseSearchGridPageIndexChanging" 
       OnSorting="uxCaseSearchGridViewSorting" OnDataBound="uxCaseSearchGrid_DataBound" AutoGenerateColumns="true"> 

       <RowStyle CssClass="gridRowLarge" /> 
       <AlternatingRowStyle CssClass="gridAltRowLarge" /> 
       <HeaderStyle CssClass="gridHeaderLarge noLink" /> 
      </asp:GridView> 
+0

您是否嘗試過查看所有CSS正在應用於該列的內容? –

回答

0

如何有關添加最小寬度屬性來你的CSS:

min-width:0; 

允許列單元(一個或多個)是在運行時重新調整大小。

+0

它沒有工作的朋友:(如果你知道任何其他風格,請發佈。 – SajithP

+0

你能分享你的gridview的呈現html嗎? –

+0

我加了一些。 – SajithP

相關問題