我正在使用 RadGrid 从数据库中检索数据。我的 RadGrid 中有更多列,因此我需要显示 RadGrid 水平滚动以防止页面展开但禁用垂直滚动以便网格的高度应该展开以始终显示网格中的所有行。我得到了结果,但 RadGrid 底部有空白。
我的 RadGrid 用户界面:
<table style="table-layout: fixed;" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="false" PagerStyle-AlwaysVisible="true"
CellPadding="0" CellSpacing="0" GridLines="None" Skin="Metro" CssClass="RadGrid_CBGrid"
HorizontalAlign="Left" AutoGenerateColumns="False" OnItemCommand="RadGrid1_ItemCommand"
OnDataBound="RadGrid1_DataBound">
<ClientSettings>
<Selecting CellSelectionMode="SingleCell"></Selecting>
<Scrolling AllowScroll="true" UseStaticHeaders="True"></Scrolling>
</ClientSettings>
<MasterTableView HierarchyLoadMode="Client" DataKeyNames="EmpID" AllowMultiColumnSorting="true"
Name="Parent">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="EmpID" EmptyDataText="NA" HeaderText="Emp ID"
UniqueName="EmpID">
</telerik:GridBoundColumn>
and so on......
-------------------
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False">
</FilterMenu>
</telerik:RadGrid>
</td>
</tr>
</table>
如果我在 RadGrid 中更改了 ClientSettings-Scrolling-AllowScroll="true"和
我得到了结果,在 RadGrid 的底部没有空格,但是水平滚动条没有出现在我的 RadGrid 中。
所以任何人都可以给我解决方案。
最佳答案
或者,如果您不想担心高度计算,请执行此操作!
// radgrid scroll horizontal only
<ClientSettings AllowDragToGroup="True" AllowGroupExpandCollapse="true">
<Scrolling AllowScroll="true" />
<ClientEvents OnGridCreated="GridCreated" />
</ClientSettings>
function GridCreated(sender, args) {
$('.rgDataDiv').removeAttr('style');
$('.rgDataDiv').attr('style', 'overflow-x: scroll;');
}
关于c# - RadGrid 底部的水平滚动空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13589557/