0

I have a problem with a user control containing a calendar control. It looks ok in the design view in visual studio 2015: this is how it looks in design view

However, in the browser, any browser, it looks like this: this is how it looks in the browser

I have tried to set the width to 330px wherever I can think of, but it always seems to get the width 1084 somehow!?

Anyone had a similar problem? Where is the problem? Is there any hope?

Here is the code for the user control:

    <%@ 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" />
4

2 回答 2

0

我不确定是否是这样,因为您声明将宽度设置为 330px,但在示例 HTML 中您将宽度设置为 100%

<asp:Calendar ... NextPrevFormat="ShortMonth" Width="100%">

取出宽度定义,让大小由父 div 定义

于 2015-10-29T19:18:05.950 回答
0

谜团已揭开!

事实证明,asp:calendar-tag 翻译成一堆 og 表标签。并且深深地嵌套在其中一些受用于导航菜单的 css 影响的 a-tags。 在此处输入图像描述

感谢您的输入!

于 2015-10-30T06:26:52.627 回答