This is a migrated thread and some comments may be shown as answers.

AppointmentContextMenuItemClicked does not fired

2 Answers 98 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Tomas
Top achievements
Rank 1
Tomas asked on 04 Jan 2012, 04:59 PM
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 Answers, 1 is accepted

Sort by
0
Tomas
Top achievements
Rank 1
answered on 05 Jan 2012, 01:38 PM
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

0
Ivana
Telerik team
answered on 06 Jan 2012, 01:04 PM
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
Tags
Scheduler
Asked by
Tomas
Top achievements
Rank 1
Answers by
Tomas
Top achievements
Rank 1
Ivana
Telerik team
Share this question
or