We help IT Professionals succeed at work.

Label control show thru calendar control on .Net 1.1 webform.

LVMiner
LVMiner asked
on
How can I prevent the label control from showing through the calendar on a webform? See image.
untitled.bmp
Comment
Watch Question

Commented:
that should not happen which vs are you using
make sure you closing and opening tags are formatted properly in the html view
like below
  <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    <asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>

Author

Commented:
Here is my markup. I do not see any issues:

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication3.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
  <HEAD>
    <title>WebForm1</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name=vs_defaultClientScript content="JavaScript">
    <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
  </HEAD>
  <body MS_POSITIONING="GridLayout">      
    <form id="Form1" method="post" runat="server">
            <asp:Calendar id=Calendar1 runat="server" Font-Size="9pt" BackColor="White" BorderColor="Black" style="POSITION: absolute; TOP: 232px; LEFT: 136px" Width="330px" ForeColor="Black" BorderStyle="Solid" NextPrevFormat="ShortMonth" CellSpacing="1" Height="250px" Font-Names="Verdana">
            <TodayDayStyle ForeColor="White" BackColor="#999999">
            </TodayDayStyle>
            <DayStyle BackColor="#CCCCCC">
            </DayStyle>
            <NextPrevStyle Font-Size="8pt" Font-Bold="True" ForeColor="White">
            </NextPrevStyle>
            <DayHeaderStyle Font-Size="8pt" Font-Bold="True" Height="8pt" ForeColor="#333333">
            </DayHeaderStyle>
            <SelectedDayStyle ForeColor="White" BackColor="#333399">
            </SelectedDayStyle>
            <TitleStyle Font-Size="12pt" Font-Bold="True" Height="12pt" ForeColor="White" BackColor="#333399">
            </TitleStyle>
            <OtherMonthDayStyle ForeColor="#999999">
            </OtherMonthDayStyle></asp:Calendar>
            <asp:Label style="Z-INDEX: 104; POSITION: absolute; TOP: 288px; LEFT: 216px" id=Label2 runat="server" Width="96px" BackColor="Transparent" ForeColor="Transparent">Label</asp:Label>
      </form>
      </body>
</HTML>

Commented:
its your asbsolute positioning that is causing this
play with the position:absolute;Top:288px;Left:216px;


for instance
change this
 <asp:Label style="Z-INDEX: 104; POSITION: absolute; TOP: 288px; LEFT: 216px" id=Label2 runat="server" Width="96px" BackColor="Transparent" ForeColor="Transparent">Label</asp:Label>

 to something like
<asp:Label style="Z-INDEX: 104; POSITION: absolute; TOP: 230px; LEFT: 10px" id=Label2 runat="server" Width="96px" BackColor="Transparent" ForeColor="Transparent">Label</asp:Label>
and se what fits your need

Author

Commented:
What I have in my actual work application I am working on is a group of controls in an html table. The calender is floating above the table and I am controlling the visibility dependent upon user actions. Moving the position of the label is not an option rather I want the calendar to have a non-transparent back if that is possible.
Commented:
try to add a higher z-index to the calander control
Z-INDEX: 120;

Author

Commented:
I set the label z-index to 0 and the calendar to 100. The label text no longer shows through the calendar.