Kevin
Kevin

Reputation: 4848

Bring javascript calendar control to the front?

I have two javascript date pickers on my asp.net site: enter image description here

When I click the from date picker, it looks like this: enter image description here

As you can see, the calendar pop-up appears behind the next set of fields on the screen.

My question is, what can I do to make this control appear in front of (or, over, rather) the fields on the screen?

EDIT: Here is the code for this particular date picker:

<td rowspan="2" style="background-color: #A5C2FA; padding-left: 1px; text-align: center;">
  <a onclick=" showCalendarControl(txtFromDate) " href="#">
  <img src="../images/calendar.gif" style="height: 20px; width: 20px;" border="0" alt="Calendar" /></a>
 </td>

And here is my CSS (I've added the z-index change for ui-datepicker, but it's doesn't appear to help):

<style type="text/css">
    .body
    {
        background-color: #006699;
    }

    .outermost_body
    {
        background: White;
        border-color: Black;
        border-style: solid;
        border-width: 2px;
        height: 120px;
        left: 10px;
        position: absolute;
        text-align: left;
        top: 200px;
        width: 700px;
    }

    .outermost_grid
    {
        height: 320px;
        left: 10px;
        position: absolute;
        text-align: left;
        top: 200px;
        width: 500px;
    }

    .searchTable
    {
        background-color: #C9EAF3;
        left: 5px;
        padding: 1px;
        position: absolute;
        text-align: left;
        top: 50px;
        width: 700px;
        z-index: 900;
    }

    .fieldcellText input
    {
        background-color: #D7E5F2;
        border: 1px solid #284279;
        color: #102132;
        font: 11px Verdana, Geneva, Arial, Helvetica, sans-serif;
        margin-left: 0px;
        width: 150px;
    }

    .ui-datepicker
    {
        z-index: 999;
    }
</style>

Upvotes: 0

Views: 1906

Answers (2)

painotpi
painotpi

Reputation: 6996

z-index works only on positioned elements

position:absolute, position:relative, or position:fixed

try this,

.ui-datepicker{
    position: relative;
    z-index: 1001;
}

Upvotes: 3

chockleyc
chockleyc

Reputation: 581

You should be able to set the z-index of the datepicker. Try adding this to the bottom of your css sheet.

.ui-datepicker {
  z-index: 999;
}

Upvotes: 1

Related Questions