2

编辑
通过以下答案之一,我能够更正此问题以在表格中进行渲染。我仍然在我的 ListViews 中看到这个问题。我已经为 ListView 尝试了这个 CSS,但它没有纠正这个问题。

/* FIX FOR CALENDAR IN TABLE */
.DateTime_Edit
{
    white-space: nowrap;
}
.DateTime_Edit table
{
    border: solid 0 #FFFFFF;
    width: 0;
    height: 0;
    padding: 0;
    margin: 0;
}
.DateTime_Edit table tr td
{
    border: solid 0 #FFFFFF;
    padding: 0;
    margin: 0;
}
/* LISTVIEW, NOT WORKING */    
.DateTime_Edit table.listview
    {
        border: solid 0 #FFFFFF;
        width: 0;
        height: 0;
        padding: 0;
        margin: 0;  
    }
    .DateTime table.listview tr td
    {
        border: solid 0 #FFFFFF;
        padding: 0;
        margin: 0;  
    }


在列表视图中
替代文本 http://www.imageunload.com/public/15867/CSSIssue2.png?no_history 在表格
替代文本中 http://www.imageunload.com/public/15852/CSSIssue.jpg?no_history


字段模板定义:

<%@ Control Language="C#" CodeBehind="DateAjaxCalendar_Edit.ascx.cs" Inherits="WarehouseLogging.DateAjaxCalendar_EditField" %>
<div class="DateTime_Edit">
<asp:TextBox ID="TextBox1" runat="server" Text='<%# FieldValueEditString %>' CssClass="droplist"></asp:TextBox>
<asp:Image runat="Server" CssClass="CalendarIcon" ID="imgCalendar1" ImageUrl="~/Images/calendar.gif" />
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" PopupButtonID="imgCalendar1"
    TargetControlID="TextBox1" CssClass="custcal1">
</ajaxToolkit:CalendarExtender>
<ajaxToolkit:FilteredTextBoxExtender ID="fltrTextBox1" runat="server" TargetControlID="TextBox1"
    FilterType="Custom, Numbers" ValidChars="/">
</ajaxToolkit:FilteredTextBoxExtender>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" CssClass="droplist"
    ControlToValidate="TextBox1" Display="Dynamic" Enabled="false" />
<asp:DynamicValidator runat="server" ID="DynamicValidator1" CssClass="droplist" ControlToValidate="TextBox1"
    Display="Dynamic" />
</div>
4

4 回答 4

2

另一种解决方案是用另一种命名样式覆盖这些样式。新样式需要出现在 .css 文件本身中的上述表格样式之后。(css 的优先顺序是它出现在 .css 文件中的位置...)为该控件设置特定样式会阻止其他样式将来执行相同的操作。

我编写了这种样式,将其放在 Site.css 文件的末尾,并将我的整个“DateTime_Edit”FieldTemplate Contorl 包裹在其中:

.DateTime_Edit
{
    white-space: nowrap !important;
}
.DateTime_Edit table
{
    border: solid 0 #FFFFFF !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}
.DateTime_Edit table tr td
{
    border: solid 0 #FFFFFF !important;
    background-color: #FFFFFF !important;
    padding: 0 !important;
    margin: 0 !important;
}

编辑:为“td”添加了背景颜色。添加 !important 到所有内容(可能不需要)

希望默认的 Site.css 文件将在后续版本中更新。

于 2009-04-21T19:00:19.407 回答
0

编辑 2

我会说这些人是罪魁祸首

body.template table.listview th, table.gridview th, table.detailstable th, body.template table.listview td, table.gridview td, table.detailstable td
{
}

body.template table.listview td, table.gridview td, table.detailstable td
{
}

它们指定了一种样式,将应用于<td>表下方的所有类名称为 listview、detailstable 和 gridview。问题是它们也会被子表继承

您可以尝试创建第二组这些样式,但将它们从

table.listview td

table.listview td table td

并取消设置已应用的任何样式。这将覆盖由日历扩展器创建的嵌套表中的样式

编辑

好的,如果没有看到 DynamicDataSite 表的整个 StyleSheet 就很难判断,但请查看该表的 CSS 是否是使用指定的

Table
{
   //...
}
TD
{
   //...
}

或使用特定的 .classnames 或 #Ids

如果是前者,您需要做一些 CSS 体操来覆盖嵌套表的样式,以撤消应用于主表的样式。例如

//Top Level Tables
table td
{
    color: Red;
}

//Nested Tables
table td table td
{
    color: Blue
}

原来的

尝试将CalendarExtender包含它的目标控件的表放在外面。从外观<td>上看,选择器中的 's 继承了父表 CSS。

于 2009-04-21T17:56:27.813 回答
0

通过查看这篇文章,您可能会获得有关如何解决问题的线索:嵌套元素上的 CSS 和覆盖样式

于 2009-04-21T21:39:07.963 回答
0

此问题的修复程序位于此处的 DD 预览项目中,名为AjaxToolkitFixes.css,位于网站的根目录中。

只需复制到站点的根目录并在 Site.Master 文件中添加引用即可。

于 2009-04-22T08:29:19.850 回答