Popup Calendar Issue

Discussion in 'ASP .Net Web Controls' started by IntraRELY, Apr 6, 2007.

  1. IntraRELY

    IntraRELY Guest

    When I click the next or previous month in the Calendar control the Calendar
    disapprears. I assume this is due to the post back. This is the expected and
    needed behavior when you click a day. However, when you are changing
    months, you are not selecting a date, so you have to click the Calendar
    Popup link again and it will be on the previous/next, which ever you
    clicked, month so you can select the date you require.

    I need a way to sort through the months, w/o it closing. Any ideas?

    Thanks,

    Steve

    ------------------------------------------------------------------------
    ----------------------------Problem Prototype-------------------------
    ------------------------------------------------------------------------

    <%@ Page Language="VB" %>
    <script runat="server">
    </script>
    <head runat="server">
    <script type="text/javascript">
    function displayCalendarBegin(cal)
    {
    var datePicker = document.getElementById(cal);
    datePicker.style.display = 'block';
    }
    </script>
    <style type="text/css">
    .calStyle
    {
    display:none;
    position:absolute;
    border:solid 2px black;
    background-color:White;
    }
    </style>
    <title>Calendar Test</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <h3>Time Entry</h3>
    <div class =calStyle ID=calBegin>
    <asp:Calendar ID="calStartDateTimeBegin" runat="server"
    ToolTip="Select begin date to view hours." />
    </div>
    <img src="App_Themes/DefaultTheme/Images/CalendarLink.jpg"
    onclick="displayCalendarBegin('calBegin')" />
    </div>
    </form>
    </body>
    </html>
    IntraRELY, Apr 6, 2007
    #1
    1. Advertising

  2. IntraRELY

    marss Guest

    IntraRELY wrote:
    > When I click the next or previous month in the Calendar control the Calendar
    > disapprears. I assume this is due to the post back. This is the expected and
    > needed behavior when you click a day. However, when you are changing
    > months, you are not selecting a date, so you have to click the Calendar
    > Popup link again and it will be on the previous/next, which ever you
    > clicked, month so you can select the date you require.
    >
    > I need a way to sort through the months, w/o it closing. Any ideas?
    >
    > Thanks,
    >
    > Steve
    >
    > ------------------------------------------------------------------------
    > ----------------------------Problem Prototype-------------------------
    > ------------------------------------------------------------------------
    >
    > <%@ Page Language="VB" %>
    > <script runat="server">
    > </script>
    > <head runat="server">
    > <script type="text/javascript">
    > function displayCalendarBegin(cal)
    > {
    > var datePicker = document.getElementById(cal);
    > datePicker.style.display = 'block';
    > }
    > </script>
    > <style type="text/css">
    > .calStyle
    > {
    > display:none;
    > position:absolute;
    > border:solid 2px black;
    > background-color:White;
    > }
    > </style>
    > <title>Calendar Test</title>
    > </head>
    > <body>
    > <form id="form1" runat="server">
    > <div>
    > <h3>Time Entry</h3>
    > <div class =calStyle ID=calBegin>
    > <asp:Calendar ID="calStartDateTimeBegin" runat="server"
    > ToolTip="Select begin date to view hours." />
    > </div>
    > <img src="App_Themes/DefaultTheme/Images/CalendarLink.jpg"
    > onclick="displayCalendarBegin('calBegin')" />
    > </div>
    > </form>
    > </body>
    > </html>


    The most of the changes that is made by the means of client-side
    JavaScript do not post to the server.
    You should pass the changes to the server manually and correct the
    state of your Popup Calendar. For example:

    Html:

    .....
    function displayCalendarBegin(cal)
    {
    var datePicker = document.getElementById(cal);
    datePicker.style.display = 'block';
    //save the changes to hidden field
    document.getElementById('hidCalendarVisibility').value = 'block';
    }
    .....
    <div class =calStyle ID=calBegin runat=server> //add runat="server"
    attribute
    .......
    //add hidden field to store the changes
    <input type=hidden id="hidCalendarVisibility" runat=server />
    .....

    Code: (C#, but I think you will understand)
    protected void Page_Load(object sender, EventArgs e)
    {
    calBegin.Style["display"] = hidCalendarVisibility.Value;
    }
    Maybe it helps.
    marss, Apr 6, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Saravana
    Replies:
    0
    Views:
    491
    Saravana
    Jul 11, 2003
  2. Shevek
    Replies:
    3
    Views:
    6,035
    Shevek
    Jun 23, 2004
  3. Shevek
    Replies:
    0
    Views:
    383
    Shevek
    Jun 23, 2004
  4. Parthiv Joshi
    Replies:
    1
    Views:
    663
    Samuel L Matzen
    Jul 6, 2004
  5. Jens Peter Hansen
    Replies:
    7
    Views:
    520
    Randy Webb
    Jun 19, 2004
Loading...

Share This Page