AppointmentContextMenuItemClicked does not fired

3 posts, 0 answers
  1. Tomas
    Tomas avatar
    2 posts
    Member since:
    May 2009

    Posted 04 Jan 2012 Link to this post

    1) RadScheduler context menu does not fire AppointmentContextMenuItemClicked event.

    (version 2011.3.1227.40)

    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Web.Script.Services;
    using System.Web.Services;
    using Telerik.Web.UI;
     
    namespace Naucrates.Formcrates.Web.Form
    {
        [WebService]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [ScriptService]
        public partial class TestScheduler : System.Web.UI.Page
        {
            protected void Page_Init(object sender, EventArgs e)
            {
                var Control = new RadScheduler();
                Control.ID = "test";
                Page.Form.Controls .Add(Control);
                Control.AllowDelete = false;
                Control.AllowEdit = false;
                Control.AllowInsert = false;
                Control.FirstDayOfWeek = DayOfWeek.Monday;
                Control.LastDayOfWeek = DayOfWeek.Sunday;
                Control.ShowFullTime = false;
     
     
                Control.SelectedView = SchedulerViewType.MonthView;
                Control.ShowViewTabs = true;
     
                Control.ShowAllDayRow = true;
                Control.DayView.UserSelectable = false;
                Control.WeekView.UserSelectable = false;
                Control.TimelineView.UserSelectable = false;
     
                Control.WebServiceSettings.Path = Request.Url.AbsoluteUri;
                Control.WebServiceSettings.ResourcePopulationMode = SchedulerResourcePopulationMode.ClientSide;
     
     
                Control.TimeZoneOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
                Control.VisualTimeZoneOffset = Control.TimeZoneOffset;
                Control.Culture = new CultureInfo("cs-CZ");
     
                Control.ShowDateHeaders = false;
                var menu = new RadSchedulerContextMenu();
                menu.Items.Add(new RadMenuItem("test1"));
                menu.Items.Add(new RadMenuItem("test2") { PostBack = true, Value = "val" });
                Control.AppointmentContextMenus.Add(menu);
     
                Control.AppointmentContextMenuItemClicked += Control_AppointmentContextMenuItemClicked;
                Control.AppointmentContextMenuItemClicking += Control_AppointmentContextMenuItemClicking;
            }
     
            void Control_AppointmentContextMenuItemClicking(object sender, AppointmentContextMenuItemClickingEventArgs e)
            {
                System.Diagnostics.Debug.WriteLine("CLICKING!");
            }
     
            protected void Control_AppointmentContextMenuItemClicked(object sender, AppointmentContextMenuItemClickedEventArgs e)
            {
                System.Diagnostics.Debug.WriteLine("CLICK!");
            }
     
            [WebMethod]
            public static IEnumerable<AppointmentData> GetAppointments(SchedulerInfo schedulerInfo)
            {
                var data = new List<AppointmentData>();
                data.Add(new AppointmentData {Start = DateTime.Today, End = DateTime.Today.AddDays(2),Description = "TEST", Subject = "test"});
                return data;
            }
     
            [WebMethod]
            public static IEnumerable<ResourceData> GetResources(SchedulerInfo schedulerInfo)
            {
                return new List<ResourceData>();
            }
        }
    }



    2) Culture property does not working properly (see image).

    What am I doing wrong?
    Thanks,
    Tomas Svec


  2. Tomas
    Tomas avatar
    2 posts
    Member since:
    May 2009

    Posted 05 Jan 2012 Link to this post

    Two horrible days and I think this is a bug. 

    My w
    orkarround is:

                Control.OnClientAppointmentContextMenuItemClicking = "OnClientAppointmentContextMenuItemClicking";
                Control.OnClientAppointmentContextMenuItemClicked = "OnClientAppointmentContextMenuItemClicked";
     
                var js =
                    @"
    var savedRenderingManager = null;
     
    function OnClientAppointmentContextMenuItemClicking(sender, eventArgs) {
        savedRenderingManager = sender._renderingManager;
        sender._renderingManager = null;
    }
    function OnClientAppointmentContextMenuItemClicked(sender, eventArgs) {
        sender._renderingManager = savedRenderingManager;
    }
    ";
                Page.ClientScript.RegisterClientScriptBlock(GetType(),"sch",string.Format("<script>{0}</script>",js));

    Tomas

  3. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 06 Jan 2012 Link to this post

    Hi Tomas,

    When using a web service as a data provider for RadScheduler's control, the server events AppointmentContextMenuItemClicking and AppointmentContextMenuItemClicked are not fired -- the respective client events should be used instead.

    As for the localization when using web services, you could refer to the following help article for instructions how to configure it: Localization for web services mode.

    Kind regards,
    Ivana
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top