Results 1 to 5 of 5

Thread: JavaScript and ASP.NET Calendar

  1. #1
    Join Date
    May 2008
    Posts
    860

    JavaScript and ASP.NET Calendar

    Struggling with an ASP.NET Calendar which closes when I press the "previous/next month".

    I will allow it to be closed, but closed only when a select date.

    HTML Code:
    <script type="text/javascript"> 
    var timeout = 300; 
    was close hours = 0; 
    var dropdown = 0; 
    
    mopen function (id) 
    {
    mcancelclosetime (); 
    if (drop down) dropdown.style.visibility = 'hidden'; 
    dropdown = document.getElementById (id); 
    dropdown.style.visibility = 'visible'; 
    }
    
    function mclose () 
    {
    if (drop down) dropdown.style.visibility = 'hidden'; 
    }
    
    function mclosetime () 
    {
    close hours = window.setTimeout (mclose, timeout); 
    } 
    
    function mcancelclosetime () 
    {
    if (close hours) 
    {
    window.clearTimeout (close hours); 
    close hours = null; 
    }
    } 
    document.onclick = mclose; 
    </script>
    HTML Code:
    <div id="drop"> 
    <p href="#" onmouseover="mopen('1')" onmouseout="mclosetime()"> Choose date </p> 
    <div id="1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> 
    <asp:Calendar ID="Calendar1" runat="server" BackColor="Red"> </asp:Calendar> 
    </div> 
    </div>

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: JavaScript and ASP.NET Calendar

    I do not think the JavaScript is able to distinguish between the different places to click on the calendar, so when I had a similar case, I chose to add the calendar in an update panel to run postbacks by click on the day and the changing of the month. That way I could control the visibility, the text field value, etc backend.

  3. #3
    Join Date
    May 2008
    Posts
    860

    Re: JavaScript and ASP.NET Calendar

    You did that in AJAX?

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: JavaScript and ASP.NET Calendar

    Yes, Update Panel is an AJAX component. When you are using ASP.net 3.5 flows of these components together with the very common, and the use of the go a breeze

    Have read some about such partial-page-postbacks using updatepanels genes is a whole bunch of data at every post back, so that the load on the server eventually can become great. That is why I mentioned this to use: we should be careful to use updatepanels sections of the website where there is heavy traffic. This is not the case for management systems, or other type of web applications where only a select group has access to the website.

  5. #5
    Join Date
    May 2008
    Posts
    860

    Re: JavaScript and ASP.NET Calendar

    Have tried to insert AJAX components, first, because I thought this is the easiest way, but will typically Prefix error message:

    "This control can not be displayed because its TagPrefix is not registered in this Web Form."

    So I registered:

    <%@ Register Assembly = "AjaxControlToolkit" Namespace = "AjaxControlToolkit" TagPrefix = "id"%>
    but it will still not use the controller.

Similar Threads

  1. Replies: 2
    Last Post: 07-02-2012, 07:50 PM
  2. Replies: 5
    Last Post: 23-04-2011, 10:19 PM
  3. Replies: 3
    Last Post: 18-10-2010, 12:12 PM
  4. Calendar javascript in a JSP form
    By technika in forum Software Development
    Replies: 4
    Last Post: 22-02-2010, 07:10 PM
  5. How to Create an Advent Calendar with JavaScript?
    By MELTRONICS in forum Software Development
    Replies: 5
    Last Post: 05-02-2010, 03:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,510,836.14979 seconds with 16 queries