我在ASP.net中有一个页面,它有一个基于数据表自动生成的表,并使用Telerik RadGrid显示,我希望页面大小保持不变,如果表太宽,它应该有自己的滚动杆
我已经使用IE9和Firefox进行了测试,他们都在页面上放置了滚动条而不是表格。
如果我使用IE9中的web开发工具栏并将模式设置为IE7,它会使用表格上的滚动呈现我想要的效果!
ASP标记代码如下所示:
<%@ Page Title="Data Audit" Language="C#" Theme="Editor" MasterPageFile="~/MasterPages/MasterPlanEditor.Master"
AutoEventWireup="True" CodeBehind="DataAudit.aspx.cs" Inherits="IFMA.MasterPlan.Web.Modules.Administrator.DataAuditing.DataAudit" %>
<%@ Register Src="../../../Common/Controls/ContentTitleBar.ascx" TagName="ContentTitleBar"
TagPrefix="IFMA" %>
<%@ Register Src="../../../Common/Controls/CMSSection.ascx" TagName="CMSSection"
TagPrefix="IFMA" %>
<%@ Register Src="../../../Common/Controls/PageMessage.ascx" TagName="PageMessage"
TagPrefix="IFMA" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
<!-- AJAX --->
<telerik:RadAjaxManager ID="AjaxManager" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxPanel">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadAjaxPanel" LoadingPanelID="AjaxLoadingPanel" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel" runat="server" Skin="Default" />
<telerik:RadTabStrip ID="TabStrip" runat="server" Skin="Default">
<Tabs>
<telerik:RadTab Text="Data Audit" Selected="true">
</telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<div class="BlueContentContainer">
<div class="PaddingContentContainer">
<IFMA:PageMessage ID="pageMessage" runat="server" />
Please select the audit entity:
<telerik:RadComboBox ID="cmbAuditSelection" runat="server" AllowCustomText="false"
OnItemsRequested="cmdAuditSelection_OnItemsRequested" EnableLoadOnDemand="true"
Width="350px" OnSelectedIndexChanged="cmbAuditSelection_OnSelectedIndexChanged"
CausesValidation="false" AppendDataBoundItems="true" EmptyMessage="Please Select"
AutoPostBack="true" Skin="Office2007" />
<br />
<br />
<asp:Panel ID="GridPanel" BorderderStyle="Solid" BorderColor="MenuBar" ScrollBars="Auto"
Height="98%" runat="server">
<telerik:RadGrid ID="Grid" Skin="Office2007" AllowPaging="false" Style="width: auto"
ShowGroupPanel="false" runat="server" OnColumnCreated="Grid_OnColumnCreated"
GridLines="Both">
<MasterTableView AutoGenerateColumns="True" HeaderStyle-Wrap="false" ShowHeadersWhenNoRecords="false" />
</telerik:RadGrid>
</asp:Panel>
</div>
</div>
</asp:Content>
和css
我疯狂地试图解决这个问题,我没有做过很多CSS,所以希望有人知道。
答案 0 :(得分:5)
你可以用
包装表格<div style="overflow:auto">
your table here
</div>