【问题标题】:Gridview with flexible height具有灵活高度的Gridview
【发布时间】:2013-11-28 10:56:00
【问题描述】:

我有一个固定高度为 450 像素的网格视图,最多可覆盖 15 行。我在网格中有一个垂直滚动条来滚动。我希望如果记录数少于 8 则 gridview 的高度必须自动降低。但对于更多记录,高度不应超过 450 像素。请帮忙!

【问题讨论】:

  • 谢谢你们,它现在工作正常。我必须在 div 中设置 max height: 450 px。以及网格视图 CSS 中的 height:auto

标签: asp.net css gridview


【解决方案1】:

尝试用容器 div 包装 gridview 并对其应用 CSS。

CSS

<style type="text/css">
 #grid-view-container
 {
  height:auto;
  overflow:scroll;
  max-height:450px;
 }
</style>

在 .aspx 中

<div id="grid-view-container">

    <asp:GridView ID="gvSample" runat="server">/GridView>

</div>

【讨论】:

    【解决方案2】:

    你可以在样式标签中设置css属性

    height:auto;max-height:450px;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-02-14
      • 1970-01-01
      • 1970-01-01
      • 2019-05-12
      • 2014-06-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多