Hi!
Is there anyone having experience with the integration of the Telerik AJAX controls and SharePoint 2010? To make things certain, I've followed the instructions at http://www.telerik.com/help/aspnet-ajax/moss-create-ajax-enabled-sharepoint-webpart-radcontrols.html but I am encountering troubles:
First, i created the prototype in 100% pure ASP.NET 3.5 - no problems at all, behaving well.
Then I simply copy & pasted the source codes from the pure ASP.NET pages into SharePoint Application Pages. My SharePoint development machine is a virtual image of a windows 2008 R2 server with SP2010, MS SQL 2008 R2 and MS VS2010. Also in this environment everything is working as it should (see attached images "develop_srv_01" and "develop_srv_02").
But by deploying the *.WSP file to the production ("life") SharePoint server, all of a sudden bloody hell breaks out.
First of all - the Advanced Edit/Insert Form of the RadScheduler component does not open. I would like to have it as a modal window but that does not work on the production server: I double click in a TimeSlot of the RadScheduler. The LoadingPanel indicates that "something happens" and, after a while, it goes back to normal (=no visual indication of business). However, the AdvacedForm does not open (see attached image "prod_srv_01").
When I now click in the RadCalendar (which is located next to the Scheduler) then a PostBack is posted and - the AdvancedForm opens. And that's where the fun begins! In the Advanced Insert/Edit Form that opens this way, everything is going mad literally:
I have 2 resources in the Scheduler: Medics and Treatments. "Medics" are defined as a single choise resource and "Treatments" are designed as a multiple choice resource. Again, in the pure ASP.NET prototype and on the development server, everything is OK. But on the production server (by "opening" the AdvancedForm in this buggy way) this becomes swapped: Now all of a sudden "Medics" are a multiple choice resource and "Treatments" become a single choice resource (see attached image "prod_srv_02" and compare it against the 2 images from the development server).
In my code behind i instruct the RadScheduler:
No exception is ever is thrown...
To make things even more complicated, I can easy tell the AdvancedForm not to open as a modal window but "inline" in the scheduler by setting
and now the AdvancedForm does open when I double click a TimeSlot in the RadScheduler! But again, even then I have the swapping of the single/multiple choice resources!
I've followed the instructions at http://www.telerik.com/help/aspnet-ajax/moss-create-ajax-enabled-sharepoint-webpart-radcontrols.html and modified the 2 web.config files on the production SharePoint server. Guess those changes must be OK, otherwise I wouldn't see the Telerik AJAX controls on a SP page. Session and View states are enabled.
My 1st guess was that "something" with the loading of the internal scripts of the Telerik Web UI DLL went wrong. So i load them manually on every PostBack - without sucess.
Is there anyone out there who has a clue or can point me towards the right direction? Or even has experienced this or a simmular situation and has sucessfully overcome it?
I don't want to post the whole Page here (there are quite some controls on it), but here is the RadScheduler in question:
and here is the code behind:
Any help would be appreciated.
Is there anyone having experience with the integration of the Telerik AJAX controls and SharePoint 2010? To make things certain, I've followed the instructions at http://www.telerik.com/help/aspnet-ajax/moss-create-ajax-enabled-sharepoint-webpart-radcontrols.html but I am encountering troubles:
First, i created the prototype in 100% pure ASP.NET 3.5 - no problems at all, behaving well.
Then I simply copy & pasted the source codes from the pure ASP.NET pages into SharePoint Application Pages. My SharePoint development machine is a virtual image of a windows 2008 R2 server with SP2010, MS SQL 2008 R2 and MS VS2010. Also in this environment everything is working as it should (see attached images "develop_srv_01" and "develop_srv_02").
But by deploying the *.WSP file to the production ("life") SharePoint server, all of a sudden bloody hell breaks out.
First of all - the Advanced Edit/Insert Form of the RadScheduler component does not open. I would like to have it as a modal window but that does not work on the production server: I double click in a TimeSlot of the RadScheduler. The LoadingPanel indicates that "something happens" and, after a while, it goes back to normal (=no visual indication of business). However, the AdvacedForm does not open (see attached image "prod_srv_01").
When I now click in the RadCalendar (which is located next to the Scheduler) then a PostBack is posted and - the AdvancedForm opens. And that's where the fun begins! In the Advanced Insert/Edit Form that opens this way, everything is going mad literally:
I have 2 resources in the Scheduler: Medics and Treatments. "Medics" are defined as a single choise resource and "Treatments" are designed as a multiple choice resource. Again, in the pure ASP.NET prototype and on the development server, everything is OK. But on the production server (by "opening" the AdvancedForm in this buggy way) this becomes swapped: Now all of a sudden "Medics" are a multiple choice resource and "Treatments" become a single choice resource (see attached image "prod_srv_02" and compare it against the 2 images from the development server).
In my code behind i instruct the RadScheduler:
protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
{
try
{
RadScheduler1.ResourceTypes.FindByName("Treatment").AllowMultipleValues = true;
RadScheduler1.ResourceTypes.FindByName("Medic").AllowMultipleValues = false;
}
catch (System.Exception ex)
{
Logger.SharePointLog.LogEx(ex, "RadScheduler1_AppointmentDataBound");
}
}
No exception is ever is thrown...
To make things even more complicated, I can easy tell the AdvancedForm not to open as a modal window but "inline" in the scheduler by setting
<AdvancedForm Modal="false"
and now the AdvancedForm does open when I double click a TimeSlot in the RadScheduler! But again, even then I have the swapping of the single/multiple choice resources!
I've followed the instructions at http://www.telerik.com/help/aspnet-ajax/moss-create-ajax-enabled-sharepoint-webpart-radcontrols.html and modified the 2 web.config files on the production SharePoint server. Guess those changes must be OK, otherwise I wouldn't see the Telerik AJAX controls on a SP page. Session and View states are enabled.
My 1st guess was that "something" with the loading of the internal scripts of the Telerik Web UI DLL went wrong. So i load them manually on every PostBack - without sucess.
Is there anyone out there who has a clue or can point me towards the right direction? Or even has experienced this or a simmular situation and has sucessfully overcome it?
I don't want to post the whole Page here (there are quite some controls on it), but here is the RadScheduler in question:
<
telerik:RadScheduler
ID
=
"RadScheduler1"
runat
=
"server"
SelectedView
=
"MonthView"
Culture
=
"de-DE"
FirstDayOfWeek
=
"Monday"
Height
=
"800px"
Width
=
"100%"
HoursPanelTimeFormat
=
"H:mm"
MinutesPerRow
=
"5"
TimeLabelRowSpan
=
"3"
TimeZoneID
=
"W. Europe Standard Time"
TimeZoneOffset
=
"01:00:00"
OverflowBehavior
=
"Expand"
ColumnWidth
=
"17%"
WorkDayStartTime
=
"09:00:00"
WeekDayEndTime
=
"18:00:00"
DataEndField
=
"DtmEnd"
DataKeyField
=
"ID"
DataStartField
=
"DtmStart"
DataSubjectField
=
"Name"
DataDescriptionField
=
"Description"
DataRecurrenceField
=
"RecRule"
DataRecurrenceParentKeyField
=
"ID"
OnClientAppointmentInserting
=
"OnClientAppointmentInserting"
Skin
=
"Metro"
AppointmentStyleMode
=
"Default"
OnAppointmentDataBound
=
"RadScheduler1_AppointmentDataBound"
OnAppointmentCreated
=
"RadScheduler1_AppointmentCreated"
EnableDescriptionField
=
"True"
OnFormCreated
=
"RadScheduler1_FormCreated"
EnableExactTimeRendering
=
"True"
DisplayRecurrenceActionDialogOnMove
=
"True"
WorkDayEndTime
=
"18:00:00"
ShowNavigationPane
=
"false"
OnTimeSlotCreated
=
"RadScheduler1_TimeSlotCreated"
OnAppointmentCommand
=
"RadScheduler1_AppointmentCommand"
WeekView-UserSelectable
=
"False"
DayView-UserSelectable
=
"False"
MonthView-UserSelectable
=
"False"
>
<
AdvancedForm
Modal
=
"true"
Enabled
=
"true"
EnableResourceEditing
=
"true"
EnableCustomAttributeEditing
=
"true"
/>
<
ResourceTypes
>
<
telerik:ResourceType
DataSourceID
=
"SqlDataSourceMedics"
ForeignKeyField
=
"Medic"
KeyField
=
"ID"
Name
=
"Arzt"
TextField
=
"Name"
/>
<
telerik:ResourceType
DataSourceID
=
"SqlDataSourceTreatment"
ForeignKeyField
=
"Treatment"
KeyField
=
"ID"
Name
=
"Behandlung"
TextField
=
"Description"
/>
</
ResourceTypes
>
<
Localization
AdvancedNewAppointment
=
"Neues Zeitfenster"
AdvancedEditAppointment
=
"Zeitfenster bearbeiten"
AdvancedSubject
=
"Betreff"
AdvancedDescription
=
"Beschreibung"
AdvancedRecurrence
=
"Serie"
AdvancedRecurEvery
=
"jeden"
HeaderDay
=
"Tag"
HeaderMonth
=
"Monat"
HeaderTimeline
=
"Zeitlinie"
HeaderToday
=
"Heute"
HeaderWeek
=
"Woche"
Save
=
"Speichern"
Show24Hours
=
"24 Stunden Ansicht"
ShowBusinessHours
=
"Arbeitszeit Ansicht"
/>
<
AppointmentTemplate
>
<
b
><%# Eval("Subject") %></
b
>
<
br
/><
br
/>
<
asp:Label
runat
=
"server"
ID
=
"lblTreatments"
></
asp:Label
>
<
br
/><
br
/>
<
asp:Label
runat
=
"server"
ID
=
"lblMedic"
></
asp:Label
>
</
AppointmentTemplate
>
</
telerik:RadScheduler
>
and here is the code behind:
using System;
using System.Globalization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Telerik.Web.UI;
namespace ShareVision.SharePoint2010.MedResWebParts.Layouts.MedResWebParts
{
/// <
summary
>
/// <
para
>
/// MedRes Verwaltung durch Admin - TimeFrames.
/// </
para
>
/// <
para
>
/// Ermöglicht das Erstellen von Einmal- und Serienterminen (=Behandlungen) durch den Arzt.
/// </
para
>
/// </
summary
>
public partial class MgmtTimeFrame : LayoutsPageBase
{
/// <
summary
>
/// Für 1:n Beziehungen kann der Telerik Scheduler keine automatische Datenbindung.
/// Vielmehr muss man hierzu einen eigenen FactoryProvider erstellen welcher diese 1:n Zuordnung pflegt (insert/delete).
/// </
summary
>
private MedResSchedulerProvider provider;
protected void Page_Init(object sender, EventArgs e)
{
//EnsureChildControls();
provider = new MedResSchedulerProvider();
provider.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MedResConnectionString"].ConnectionString;
this.RadScheduler1.Provider = provider;
System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
}
private ScriptManager CheckScriptManager()
{
Page.ClientScript.RegisterStartupScript(typeof(MgmtTimeFrame), this.ID, "_spOriginalFormAction = document.forms[0].action;_spSuppressFormOnSubmitWrapper=true;", true);
if (this.Page.Form != null)
{
string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
if (!string.IsNullOrEmpty(formOnSubmitAtt) && formOnSubmitAtt == "return _spFormOnSubmitWrapper();")
{
this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
}
}
ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
if (scriptManager == null)
{
if (Page.Form != null)
{
scriptManager = new ScriptManager();
scriptManager.ID = Page.Form.ID + "_ScriptManager";
Page.Form.Controls.Add(scriptManager);
}
}
if (scriptManager != null)
{
string telerikAssembly = typeof(RadScheduler).Assembly.FullName;
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Common.Core.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Common.jQuery.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Common.jQueryPlugins.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Common.Popup.PopupScripts.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Common.Navigation.NavigationScripts.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Menu.RadMenuScripts.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Menu.ContextMenu.RadContextMenuScripts.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Input.TextBox.RadInputScript.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Input.DateInput.RadDateInputScript.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Input.NumericTextBox.RadNumericInputScript.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Calendar.RadTimeViewScripts.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Calendar.RadCalendarCommonScript.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Calendar.RadCalendarScript.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Calendar.RadDatePicker.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Calendar.RadDateTimePickerScript.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.ComboBox.RadComboBoxScripts.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Helpers.DateTime.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.RadSchedulerScripts.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.RecurrenceEditor.RecurrenceEditor.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Week.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Week.GroupedByResource.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Week.GroupedByDate.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.MultiDay.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.MultiDay.GroupedByResource.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.MultiDay.GroupedByResource.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Day.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Day.GroupedByResource.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Month.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Month.GroupedByResource.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Month.GroupedByDate.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Timeline.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Timeline.GroupedByResource.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Views.Timeline.GroupedByDate.Model.js", telerikAssembly));
scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Scheduler.Scheduling.AdvancedTemplate.js", telerikAssembly));
}
return scriptManager;
}
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!Page.IsPostBack)
{
CheckScriptManager();
RadScheduler1.ReadOnly = false;
RadScheduler1.AllowEdit = true;
RadScheduler1.AllowInsert = true;
RadScheduler1.StartEditingInAdvancedForm = true;
RadScheduler1.StartInsertingInAdvancedForm = true;
}
}
catch (System.Exception ex)
{
Logger.SharePointLog.LogEx(ex, "MgmtTimeFrame - PageLoad");
}
}
/// <
summary
>
/// Button to go back to MedRes Admin Menu.
/// If session has expired, go 1 step backwards.
/// </
summary
>
/// <
param
name
=
"sender"
></
param
>
/// <
param
name
=
"e"
></
param
>
public void btnMenuLink_Click(object sender, ImageClickEventArgs e)
{
string url = "";
if (Session[UsedSessionVarNames.AdminViewMainMenu] != null)
url = Session[UsedSessionVarNames.AdminViewMainMenu].ToString();
else
url = "javascript:history.back();";
Response.Redirect(url);
}
/// <
summary
>
/// RadSchedular: Resourcen "Style" verwalten: Treatments = multiple choise, Medic = single choise
/// </
summary
>
/// <
param
name
=
"sender"
></
param
>
/// <
param
name
=
"e"
></
param
>
protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
{
try
{
// TODO: Diese "Farb-Bindung" geht nur bei 1:1 Resourcen; wir haben jetzt 1:n --> wie eine entspr. Farbe auswählen?
//if (e.Appointment.Resources.GetResourceByType("Behandlung") != null)
//{
// DataRowView x = (DataRowView)e.Appointment.Resources.GetResourceByType("Behandlung").DataItem;
// e.Appointment.BackColor = ColorTranslator.FromHtml(x.Row["Color"].ToString());
// e.Appointment.ForeColor = Color.Black;
//}
RadScheduler1.ResourceTypes.FindByName("Treatment").AllowMultipleValues = true;
RadScheduler1.ResourceTypes.FindByName("Medic").AllowMultipleValues = false;
}
catch (System.Exception ex)
{
Logger.SharePointLog.LogEx(ex, "RadScheduler1_AppointmentDataBound");
}
}
protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)
{
//Logger.SharePointLog.LogMsgDebug("Entering RadScheduler1_AppointmentCreated");
if (e.Appointment != null && e.Appointment.Resources.Count > 0)
{
try
{
List<
string
> behandlung = new List<
string
>();
foreach(Resource treat in e.Appointment.Resources.GetResourcesByType("Treatment"))
{
behandlung.Add(treat.Text);
}
if(behandlung.Count > 0)
{
Label assignedTo = (Label)e.Container.FindControl("lblTreatments");
assignedTo.Text = "Behandlung(-en):<
br
>" + string.Join(", ", behandlung.ToArray());
}
Resource medic = e.Appointment.Resources.GetResourceByType("Medic");
if(medic != null)
{
Label location = (Label)e.Container.FindControl("lblMedic");
location.Text = "Arzt: " + medic.Text;
}
e.Appointment.CssClass = "rsCategoryBlue";
e.Appointment.BackColor = System.Drawing.Color.PapayaWhip;
}
catch (System.Exception ex)
{
Logger.SharePointLog.LogMsgDebug("RadScheduler1_AppointmentCreated -- 1. Exception Schleife");
Logger.SharePointLog.LogEx(ex);
}
// Wenn es ein Appointment im Scheduler gibt, im kleinen Kalender den Tag als "special day" kennzeichnen
try
{
RadCalendarDay calendarDay = new RadCalendarDay();
calendarDay.Date = e.Appointment.Start;
calendarDay.IsSelectable = true;
calendarDay.ToolTip = e.Appointment.Subject;
calendarDay.ItemStyle.CssClass = "rcOrdination";
RadCalendar1.SpecialDays.Add(calendarDay);
RadCalendar SchedulerDetailCalendar = this.RadCalendar1.FindControl("SelectedDateCalendar") as RadCalendar;
if (SchedulerDetailCalendar != null)
SchedulerDetailCalendar.SpecialDays.Add(calendarDay);
}
catch(System.Exception ex)
{
Logger.SharePointLog.LogMsgDebug("RadScheduler1_AppointmentCreated -- 2. Exception Schleife");
Logger.SharePointLog.LogEx(ex);
}
}
//Logger.SharePointLog.LogMsgDebug("Leaving RadScheduler1_AppointmentCreated");
}
/// <
summary
>
/// Per default, "all day" event is beeing checked (only) in Month view. This is the default TELERIK AJAX RadScheduler behaviour.
/// Here we disable this by manually hooking into the correspondending control (=unchecking the checkbox via code).
/// </
summary
>
/// <
param
name
=
"sender"
></
param
>
/// <
param
name
=
"e"
></
param
>
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
{
try
{
Logger.SharePointLog.LogMsgDebug("RadScheduler1_FormCreated() - entering");
if (e.Container.Mode == SchedulerFormMode.AdvancedEdit || e.Container.Mode == SchedulerFormMode.AdvancedInsert)
{
CheckBox allDayCheckbox = (CheckBox)e.Container.FindControl("AllDayEvent");
allDayCheckbox.Checked = false;
allDayCheckbox.Style.Add("visibility", "hidden");
RadDatePicker startTime = e.Container.FindControl("StartTime") as RadDatePicker;
if (startTime != null)
{
startTime.Enabled = true;
startTime.Visible = true;
}
RadDatePicker endTime = e.Container.FindControl("EndTime") as RadDatePicker;
if (endTime != null)
{
endTime.Enabled = true;
endTime.Visible = true;
}
//Resource medic = e.Appointment.Resources.GetResourceByType("ResMedic");
//if (medic != null)
//{
// Label location = (Label)e.Container.FindControl("lblMedic");
// location.Text = "Arzt: " + medic.Text;
// RadTextBox attrAnnotationsTextbox = (RadTextBox)e.Container.FindControl("ResMedic");
// attrAnnotationsTextbox.Label = "ARZT: ";
//}
//RadTextBox lblMedic = (RadTextBox)e.Container.FindControl("ResMedic");
//if (lblMedic != null)
//{
// lblMedic.Label = "ARZT: ";
//}
//RadTextBox lblTreatment = (RadTextBox)e.Container.FindControl("ResTreatment");
//if (lblTreatment != null)
//{
// lblTreatment.Label = "Behandlung: ";
//}
if (e.Container.Mode == SchedulerFormMode.AdvancedInsert)
{
startTime.SelectedDate = DateTime.Now;
endTime.SelectedDate = DateTime.Now.AddHours(2);
}
//try
//{
// this.RadScheduler1.ShowAdvancedEditForm(new Appointment());
//}
//catch(Exception ex)
//{
// Logger.SharePointLog.LogEx(ex, "RadScheduler1_FormCreated() -- ShowAdvancedEditForm(new Appointment()) failed");
//}
}
Logger.SharePointLog.LogMsgDebug("RadScheduler1_FormCreated() - leaving.");
}
catch (Exception ex)
{
Logger.SharePointLog.LogEx(ex, "RadScheduler1_FormCreated()");
}
}
/// <
summary
>
/// Im kleinen RadCalendar wurde ein neues Datum ausgewählt, weiterleiten an den RadScheduler.
/// </
summary
>
/// <
param
name
=
"sender"
></
param
>
/// <
param
name
=
"e"
></
param
>
protected void RadCalendar1_SelectionChanged(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e)
{
try
{
RadScheduler1.SelectedDate = e.SelectedDates[0].Date;
}
catch (System.Exception ex)
{
Logger.SharePointLog.LogEx(ex);
}
}
/// <
summary
>
/// Im kleinen RadCalendar wurde ein neues Monat od. Jahr ausgewählt, weiterleiten an den RadScheduler.
/// </
summary
>
/// <
param
name
=
"sender"
></
param
>
/// <
param
name
=
"e"
></
param
>
protected void RadCalendar1_DefaultViewChanged(object sender, Telerik.Web.UI.Calendar.DefaultViewChangedEventArgs e)
{
try
{
RadScheduler1.SelectedDate = RadCalendar1.FocusedDate;
}
catch (System.Exception ex)
{
Logger.SharePointLog.LogEx(ex);
}
}
/// <
summary
>
/// Render Holidays in the small calendar.
/// </
summary
>
/// <
param
name
=
"sender"
></
param
>
/// <
param
name
=
"e"
></
param
>
protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
{
try
{
SqlDataSourceCheckHolidays.SelectParameters[0].DefaultValue = e.Day.Date.ToShortDateString();
DataView view = (DataView)SqlDataSourceCheckHolidays.Select(DataSourceSelectArguments.Empty);
if (view != null)
{
DataTable table = view.ToTable();
if (table.Rows.Count > 0)
{
e.Cell.ToolTip = table.Rows[0]["Name"].ToString();
e.Cell.CssClass = "rcWeekend";
}
}
}
catch (System.Exception ex)
{
Logger.SharePointLog.LogEx(ex);
}
}
/// <
summary
>
/// Wenn das Datum ein Feiertag ist, den Tag zum Bearbeiten sperren.
/// </
summary
>
/// <
remarks
>
/// Unbedingt beim TimeSlot +1 Stunde dazu zählen, da das Datum in der Datenbank wegen
/// Telerik Ctrls um 1 Stunde "verschoben" gespeichert wird.
/// </
remarks
>
/// <
param
name
=
"sender"
></
param
>
/// <
param
name
=
"e"
></
param
>
protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
{
try
{
SqlDataSourceCheckHolidays.SelectParameters[0].DefaultValue = e.TimeSlot.Start.AddHours(1).ToShortDateString();
DataView view = (DataView)SqlDataSourceCheckHolidays.Select(DataSourceSelectArguments.Empty);
if (view != null)
{
DataTable table = view.ToTable();
if (table.Rows.Count > 0)
{
string holidayName = table.Rows[0]["Name"].ToString();
if (!string.IsNullOrEmpty(holidayName))
{
e.TimeSlot.CssClass = "Disabled";
e.TimeSlot.Control.ToolTip = holidayName;
}
}
}
}
catch (System.Exception ex)
{
Logger.SharePointLog.LogEx(ex);
}
}
/// <
summary
>
/// Export a single appointment to iCalendar file
/// </
summary
>
/// <
param
name
=
"sender"
></
param
>
/// <
param
name
=
"e"
></
param
>
protected void RadScheduler1_AppointmentCommand(object sender, AppointmentCommandEventArgs e)
{
Logger.SharePointLog.LogMsgDebug("RadScheduler1_AppointmentCommand() -- START.");
Logger.SharePointLog.LogMsgDebug("Command: " + e.CommandName);
if (e.CommandName == "Insert")
{
Logger.SharePointLog.LogMsgDebug(" >> Command = INSERT");
}
else if(e.CommandName == "CmdInsert")
{
Logger.SharePointLog.LogMsgDebug(" >> Command = CmdInsert");
}
else if (e.CommandName == "Create")
{
Logger.SharePointLog.LogMsgDebug(" >> Command = Create");
}
else if (e.CommandName == "CmdCreate")
{
Logger.SharePointLog.LogMsgDebug(" >> Command = CmdCreate");
}
Logger.SharePointLog.LogMsgDebug("RadScheduler1_AppointmentCommand() -- END.");
}
}
}
Any help would be appreciated.