【发布时间】:2014-04-14 09:52:39
【问题描述】:
我有一个自定义创建的表格,并通过 CSS 在 .ascx 中对其进行样式设置。见下文:
<style>
.divTable {
display: block;
height: auto;
width: calc(100% - 25%);
font: normal 12px/150% Arial, Helvetica, sans-serif;
overflow: hidden;
text-align: left;
}
.divBody {
position: relative;
height: calc(100% - 42px);
border: 2px solid #000000;
font-size: 12px;
font-weight: normal;
top: 0px;
left: 0px;
right: 0px;
overflow-x: scroll;
overflow-y: scroll;
color: #383838;
width: auto;
height: 500px; -- this is the one I am trying to get to be the custom height; either 500px if on a view tab or auto if on another tab.
}
....
</style>
现在,这是在一个名为 DataGridForDetails 的自定义控件中。当我将它带入“查看”页面时,它会完美地列出所有内容,看起来很棒。但是,我有一个“详细信息”表,该控件可重新用于其他数据,这些数据可能在表中具有或可能没有尽可能多的项目(即用户单击视图中的一行,将它们带到详细信息页面其中有 2 个显示资产成本和时间表成本的数据网格)。
我希望能够重复使用此数据网格,以便它在视图选项卡上“可以”为 500 像素高度,但是,当它在其他页面上时为自动高度。
有没有办法做到这一点?我试过使用!important、.style1.style2。除了为其他页面创建新控件之外的所有内容(也许这是需要做的事情?)。
干杯。
【问题讨论】:
-
它现在表现如何?
-
根本不工作=(我会详细说明。它总是转到
!important标签。它不会在这两个设置之间进行证明。仍然在玩它。
标签: html asp.net css datagrid ascx