Under Resource and Resource Availability, I copied exact code to my system and here are the following problems.
| using System; |
| using System.Collections.Generic; |
| using System.Web.UI; |
| using System.Web.UI.WebControls; |
| using Telerik.QuickStart; |
| using Telerik.Web.UI; |
| namespace Telerik.Web.Examples.Scheduler.ResourceAvailability |
| { |
| public partial class DefaultCS : XhtmlPage |
| { |
| private const string UsedResourcesSessionKey = "Telerik.Web.Examples.Scheduler.ResourceAvailability.DefaultCS"; |
| private List<Resource> UsedResources |
| { |
| get |
| { |
| List<Resource> resources = Session[UsedResourcesSessionKey] as List<Resource>; |
| if (resources == null) |
| { |
| resources = new List<Resource>(); |
| Session[UsedResourcesSessionKey] = resources; |
| } |
| return resources; |
| } |
| } |
| private void Page_Load(object sender, EventArgs e) |
| { |
| if (!IsPostBack) |
| { |
| UsedResources.Clear(); |
| } |
| } |
| private void ReserveResources(ResourceCollection resources) |
| { |
| foreach (Resource res in resources) |
| { |
| if (!UsedResources.Contains(res)) |
| { |
| UsedResources.Add(res); |
| } |
| } |
| } |
| private void FreeResources(ResourceCollection resources) |
| { |
| foreach (Resource res in resources) |
| { |
| if (UsedResources.Contains(res)) |
| { |
| UsedResources.Remove(res); |
| } |
| } |
| } |
| protected void RadScheduler1_DataBound(object sender, EventArgs e) |
| { |
| foreach (Resource res in RadScheduler1.Resources) |
| { |
| res.Available = !UsedResources.Contains(res); |
| } |
| DisplayAvailableResources(); |
| } |
| protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e) |
| { |
| ReserveResources(e.Appointment.Resources); |
| } |
| protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e) |
| { |
| ReserveResources(e.Appointment.Resources); |
| } |
| protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) |
| { |
| FreeResources(e.Appointment.Resources); |
| ReserveResources(e.ModifiedAppointment.Resources); |
| } |
| protected void RadScheduler1_AppointmentDelete(object sender, SchedulerCancelEventArgs e) |
| { |
| FreeResources(e.Appointment.Resources); |
| } |
| protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e) |
| { |
| List<string> users = new List<string>(); |
| foreach (Resource user in e.Appointment.Resources.GetResourcesByType("User")) |
| { |
| users.Add(user.Text); |
| } |
| Label assignedTo = (Label) e.Container.FindControl("AssignedTo"); |
| if (users.Count > 0) |
| { |
| assignedTo.Text = "Assigned to: " + string.Join(", ", users.ToArray()); |
| } |
| else |
| { |
| assignedTo.Text = "Not assigned."; |
| } |
| Resource room = e.Appointment.Resources.GetResourceByType("Room"); |
| if (room != null) |
| { |
| Label location = (Label) e.Container.FindControl("Location"); |
| location.Text = "Location: " + room.Text; |
| } |
| } |
| private void DisplayAvailableResources() |
| { |
| List<string> users = new List<string>(); |
| foreach (Resource user in RadScheduler1.Resources.GetResourcesByType("User")) |
| { |
| if (user.Available) |
| { |
| users.Add(user.Text); |
| } |
| } |
| AvailableUsers.Text = string.Join(", ", users.ToArray()); |
| List<string> rooms = new List<string>(); |
| foreach (Resource room in RadScheduler1.Resources.GetResourcesByType("Room")) |
| { |
| if (room.Available) |
| { |
| rooms.Add(room.Text); |
| } |
| } |
| AvailableRooms.Text = string.Join(", ", rooms.ToArray()); |
| } |
| } |
| } |
<rada:AjaxSetting AjaxControlID="RadAjaxManager1">
<UpdatedControls>
<rada:AjaxUpdatedControl ControlID="tree2"></rada:AjaxUpdatedControl>
<rada:AjaxUpdatedControl ControlID="tree1"></rada:AjaxUpdatedControl>
<rada:AjaxUpdatedControl ControlID="dummy_label1" LoadingPanelId="LoadingPanel2"></rada:AjaxUpdatedControl>
<rada:AjaxUpdatedControl ControlID="dummy_label2" LoadingPanelId="LoadingPanel2"></rada:AjaxUpdatedControl>
</UpdatedControls>
</rada:AjaxSetting>
This issue has been driving me mad help would be much appreciated.
Thanks
Mark
There is a MS Slider Extender used in my AdvancedInsertTemplate of the Scheduler. The finding indicates that the error messages ,the object reference is not an object execution instance, is always shown if enabling the Ajax feature of the Scheduler in RadAjaxManager. However, it is disappearred if removing the Ajax configuration.
Could someone point me in the direction of how to solve this?
| <AdvancedInsertTemplate> |
| <div style="position: relative; background: #E6E6E6; height: 100%; border: 1px solid #666666;"> |
| <div style="margin-left: 10px; margin-top: 5px;"> |
| Description:<br /> |
| <asp:TextBox ID="Field_Subject" Rows="5" Columns="20" runat="server" Text='<%# Bind("Subject") %>' Width="95%" TextMode="MultiLine"></asp:TextBox><br /> |
| <span style="width: 50px;">Start time:</span> |
| <radCln:RadDatePicker ID="Field_StartDate" runat="server" SelectedDate='<%# Bind("Start") %>'></radCln:RadDatePicker> |
| <radCln:RadTimePicker ID="Field_StartTime" runat="server" SelectedDate='<%# Bind("Start") %>'></radCln:RadTimePicker><br/> |
| <span style="width: 50px;">End time:</span> |
| <radCln:RadDatePicker ID="Field_EndDate" runat="server" SelectedDate='<%# Bind("End") %>'></radCln:RadDatePicker> |
| <radCln:RadTimePicker ID="Field_EndTime" runat="server" SelectedDate='<%# Bind("End") %>'></radCln:RadTimePicker><br/> |
| <span style="width: 100px;">Completed Ratio:</span> |
| <asp:TextBox ID="Field_CompletedRatio" runat="server"></asp:TextBox> |
| <asp:TextBox ID="Field_CompletedRatio_Value" runat="server" ReadOnly="true" Text="1" Width="25"></asp:TextBox> <ajaxToolkit:SliderExtender ID="SliderExtender1" runat="server" Minimum="1" BoundControlID="Field_CompletedRatio_Value" TargetControlID="Field_CompletedRatio"></ajaxToolkit:SliderExtender><br/> |
| <span style="width: 100px;">Content Type ID:</span> |
| <asp:DropDownList ID="Field_ContentTypeID" runat="server" Width="204px"></asp:DropDownList><br/> |
| <span style="width: 100px;">Result Type ID:</span> |
| <asp:DropDownList ID="Field_ResultTypeID" runat="server" Width="204px"></asp:DropDownList><br/> |
| <span style="width: 100px;">Process Instance ID:</span> |
| <asp:DropDownList ID="Field_ProcessInstanceID" runat="server" Width="204px"></asp:DropDownList><br/> |
| <span style="width: 100px;">Workitem ID:</span> |
| <asp:DropDownList ID="Field_WorkitemID" runat="server" Width="204px"></asp:DropDownList> |
| <div class="blueBox" style="margin-bottom: 5px; position: absolute; bottom: 0px"> |
| <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert"> |
| <asp:Image runat="server" ID="insertImage" ImageUrl="Images/Edit.gif" AlternateText="insert" /></asp:LinkButton> |
| <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"><asp:Image runat="server" ID="Image2" ImageUrl="Images/cancel.gif" AlternateText="cancel" /></asp:LinkButton> |
| </div> |
| </div> |
| </div> |
| </AdvancedInsertTemplate> |