日历控件表现不佳
Calendar Control Behaving Badly
我对包含日历控件的用户控件有疑问。
它在 visual studio 2015 的设计视图中看起来不错:
但是,在浏览器中,任何浏览器,它看起来像这样:
我试过将宽度设置为 330px,但它似乎总是以某种方式获得宽度 1084!?
有人遇到过类似的问题吗?问题出在哪儿?
还有希望吗?
这是用户控件的代码:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TimeKalender.ascx.cs" Inherits="Blodbanken.TimeKalender" %>
<link rel="Stylesheet" type="text/css" href="StyleSheet1.css" id="style" runat="server" visible="false" />
<div class="kalender" style="width:330px;">
<asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="Black" BorderStyle="Solid" CellSpacing="1" Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" Height="250px" NextPrevFormat="ShortMonth" Width="100%">
<DayHeaderStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" Height="8pt" />
<DayStyle BackColor="#CCCCCC" />
<NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="White" />
<OtherMonthDayStyle ForeColor="#999999" />
<SelectedDayStyle BackColor="#E60000" ForeColor="White" />
<TitleStyle BackColor="Red" BorderStyle="None" Font-Bold="True" Font-Size="12pt" ForeColor="White" Height="12pt" />
<TodayDayStyle BackColor="#999999" ForeColor="White" />
</asp:Calendar>
</div>
<asp:Label ID="lblLedigeTimer" runat="server" Text="Available appointments:" Font-Bold="True"></asp:Label>
<br />
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem>08:00 </asp:ListItem>
<asp:ListItem>09:00 </asp:ListItem>
<asp:ListItem>10:00 </asp:ListItem>
<asp:ListItem>11:00 </asp:ListItem>
<asp:ListItem>12:00 </asp:ListItem>
<asp:ListItem>13:00 </asp:ListItem>
<asp:ListItem>14:00 </asp:ListItem>
<asp:ListItem>15:00 </asp:ListItem>
</asp:CheckBoxList>
<asp:Button ID="Button1" runat="server" Text="Book it!" Width="119px" />
我不确定是不是这样,因为你说你将宽度设置为 330px 但在示例 HTML 中你将宽度设置为 100%
<asp:Calendar ... NextPrevFormat="ShortMonth" Width="100%">
将其从宽度定义中取出并让尺寸由父级定义div
谜底已解!
事实证明,asp:calendar-标签翻译成一堆 og table-标签。并且深深地嵌套在一些受用于导航菜单的 css 影响的 a-tags 中。
感谢您的意见!
我对包含日历控件的用户控件有疑问。
它在 visual studio 2015 的设计视图中看起来不错:
但是,在浏览器中,任何浏览器,它看起来像这样:
我试过将宽度设置为 330px,但它似乎总是以某种方式获得宽度 1084!?
有人遇到过类似的问题吗?问题出在哪儿? 还有希望吗?
这是用户控件的代码:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TimeKalender.ascx.cs" Inherits="Blodbanken.TimeKalender" %>
<link rel="Stylesheet" type="text/css" href="StyleSheet1.css" id="style" runat="server" visible="false" />
<div class="kalender" style="width:330px;">
<asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="Black" BorderStyle="Solid" CellSpacing="1" Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" Height="250px" NextPrevFormat="ShortMonth" Width="100%">
<DayHeaderStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" Height="8pt" />
<DayStyle BackColor="#CCCCCC" />
<NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="White" />
<OtherMonthDayStyle ForeColor="#999999" />
<SelectedDayStyle BackColor="#E60000" ForeColor="White" />
<TitleStyle BackColor="Red" BorderStyle="None" Font-Bold="True" Font-Size="12pt" ForeColor="White" Height="12pt" />
<TodayDayStyle BackColor="#999999" ForeColor="White" />
</asp:Calendar>
</div>
<asp:Label ID="lblLedigeTimer" runat="server" Text="Available appointments:" Font-Bold="True"></asp:Label>
<br />
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem>08:00 </asp:ListItem>
<asp:ListItem>09:00 </asp:ListItem>
<asp:ListItem>10:00 </asp:ListItem>
<asp:ListItem>11:00 </asp:ListItem>
<asp:ListItem>12:00 </asp:ListItem>
<asp:ListItem>13:00 </asp:ListItem>
<asp:ListItem>14:00 </asp:ListItem>
<asp:ListItem>15:00 </asp:ListItem>
</asp:CheckBoxList>
<asp:Button ID="Button1" runat="server" Text="Book it!" Width="119px" />
我不确定是不是这样,因为你说你将宽度设置为 330px 但在示例 HTML 中你将宽度设置为 100%
<asp:Calendar ... NextPrevFormat="ShortMonth" Width="100%">
将其从宽度定义中取出并让尺寸由父级定义div
谜底已解!
事实证明,asp:calendar-标签翻译成一堆 og table-标签。并且深深地嵌套在一些受用于导航菜单的 css 影响的 a-tags 中。
感谢您的意见!