Calendar Double Click JS Event

2 posts, 0 answers
  1. nsrikanth 2009
    nsrikanth 2009 avatar
    39 posts
    Member since:
    Apr 2010

    Posted 30 Jan 2012 Link to this post

    hi

    in calendar control ,if user double clicks on date i need to show the alert message.

    please suggest me solution.


    thanks
    Sri
  2. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 31 Jan 2012 Link to this post

    Sri:

    I do not think there's an option for handling a double-click event for a date in RadCalendar. It is possible to open a RadAlert Window by handling the "OnDateClick" Client Event as follows:

    Default.aspx:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
        <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <%--Needed for JavaScript IntelliSense in VS2010--%>
                <%--For VS2008 replace RadScriptManager with ScriptManager--%>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <telerik:RadWindowManager runat="server" id="RadWindowManager1"></telerik:RadWindowManager>
        <script type="text/javascript">
            function ShowRadAlert(sender, eventArgs) {
                var day = eventArgs.get_renderDay();
                var date = day.get_date();
                var selectedDate = new Date(date[0], date[1] - 1, date[2]);
                radalert("You clicked " + selectedDate.toDateString(), "200px", "100px", "Calendar Date Clicked", "");
            }
        </script>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        </telerik:RadAjaxManager>
        <div>
            <telerik:RadCalendar  ID="RadCalendar1" Runat="server" AutoPostBack="false" >
            <ClientEvents  OnDateClick="ShowRadAlert" />
            </telerik:RadCalendar>
        </div>
        </form>
    </body>
    </html>

    The only alternative is to use the RadScheduler Control which does provide the "OnClientAppointmentDoubleClick" event. You can view this in the Scheduler / Client-side Events online demo.

    Hope this helps!
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top