Firing javascript on Calendar web control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RobertTheProgrammer
    New Member
    • Aug 2007
    • 58

    #1

    Firing javascript on Calendar web control

    HI all,

    Using ASP.NET, I have a calendar web control on my page for which I want to fire an event every time a user double clicks one of the dates. Here is my chunk of code that is suppose to accomplish this by assigning javascript to the "ondblclick " event for each day upon rendering.

    Code:
    protected void thisCalendar_DayRender(object sender, DayRenderEventArgs e)
    {
        e.Cell.Attributes.Add("ondblclick", "alert('You double clicked on the link');");
    }
    Pretty straightforward , I think. However, I have a problem in that my alert will not fire when the user double clicks directly on a day's number (which looks to be a link by default), but it will fire just fine when the user double clicks on a day's little box anywhere other than directly on the number.

    Methinks that something is going on that the "hyperlink" nature of the day is interfering with my double click event. But I'm not sure how to get around this.

    Any help is greatly appreciated.

    Robert
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    The Asp.NET Calendar control contains LinkButtons which the control uses in order to determine what date has been selected.

    When the ASP.NET Calendar control is disabled these link buttons are not displayed.

    I'm not sure if this will work for you but consider disabling the ASP.NET Calendar control through your Server Side code and then applying your JavaScript to it.

    -Frinny

    Comment

    Working...