【问题标题】:Cannot put horizontal scrollbar in gridview asp.net无法在gridview asp.net中放置水平滚动条
【发布时间】:2017-04-27 08:13:01
【问题描述】:

我已经尝试过将 gridview 包裹起来

 <div style="overflow-x:auto;width:800px"></div>

但它不起作用。

无论我做什么,我最终都会得到这个。 滚动条存在但我的gridview 的列宽没有根据宽度增加。像注释部分应该更大。

我在后面的代码中绑定了gridview。 这是我的 aspx 代码:

<fieldset id="fs1" class="labels" runat="server" style="border: solid; border-width: thin; width: 98%; height: auto; border-color: #a8a8a8;">
        <div style="overflow-x: auto; width: 1100px">
            <asp:GridView ID="gvReport" runat="server" AutoGenerateColumns="false" Width="100%"
                CssClass="Grid" Style="font-size: 10pt; font-family: Calibri;"
                AlternatingRowStyle-CssClass="alt"
                OnPreRender="gvReport_PreRender"
                OnPageIndexChanging="gvReport_PageIndexChanging"
                PagerStyle-CssClass="pgr">
            </asp:GridView>
 </div>
<div id="div13" style="margin-top: 10px; margin-bottom: 10px; margin-left: 10px;">
            <asp:Table runat="server">
                <asp:TableRow>
                    <asp:TableCell>
                        <asp:Button CssClass="buttons___" Width="160" ID="btnXcel" Text="Download Excel" OnClick="btnXcel_Click" runat="server" />
                        <asp:Button CssClass="buttons___" Width="160" ID="btnCSV" Text="Download CSV" OnClick="btnCSV_Click" runat="server" />
                    </asp:TableCell>
                </asp:TableRow>
            </asp:Table>
        </div>
    </fieldset>

【问题讨论】:

    标签: c# html css asp.net gridview


    【解决方案1】:

    将属性style="overflow-x:scroll" 添加到gridview 并赋予其宽度。

    【讨论】:

      猜你喜欢
      • 2011-06-27
      • 1970-01-01
      • 1970-01-01
      • 2019-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-21
      • 2020-12-17
      相关资源
      最近更新 更多