or
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ResourceEditor.ascx.cs" Inherits="ArtsHub.Controls.ResourceEditor" %><%@ Reference Control="~/shared/controls/images/ImageUploader.ascx" %><asp:PlaceHolder ID="phDynamicUploads" runat="server" /><asp:Literal ID="litTest" runat="server" Text="initialised" />public partial class ResourceEditor : System.Web.UI.UserControl{ public Globals.SectionIds Section { get; set; } public ResourceTypes ResourceType { get; set; } public void RefreshResources(TemplateChangedEventArgs e) { //BLL.Emailing.Emailing.EmailBug("Got to Refresh Resources from viewstate" , e.Resources.Count.ToString()); RenderEditor(e.Resources); } /// <summary> /// Main dynamic control load method - takes the list of resources as param /// </summary> public void RenderEditor(List<Resource> theseResources) { litTest.Text = string.Format("<h2>There were {0} Resources to load", theseResources.Count); foreach (Resource r in theseResources) { // Only process the filtered type from the control if (r.ResourceType == ResourceType) { ImageUploader thisUploader = (ImageUploader)Page.LoadControl("/shared/controls/images/ImageUploader.ascx"); thisUploader.ID = "Uploader_" + r.ResourceId.ToString(); thisUploader.SectionId = Section; thisUploader.Width = r.Width; thisUploader.Height = r.Height; thisUploader.ImageType = r.ImageType.Value; thisUploader.ImageURL = ImageFactory.GetListingImageURL((int)Section, Utilities.GetListingId, r.ImageType.Value); // Get Original Image for preview Label thisLabel = new Label(); thisLabel.Text = r.Description; //BLL.Emailing.Emailing.EmailBug("Loading res " + r.ResourceId, ""); phDynamicUploads.Controls.Add(thisLabel); phDynamicUploads.Controls.Add(thisUploader); } } }}<telerik:RadScheduler runat="server" ID="Scheduler"GroupBy="Date,JobTitle"GroupingDirection="Vertical"DataKeyField="ID" DataSubjectField="Subject"DataStartField="Start"DataEndField="End"SelectedView="MultiDayView"ShowAllDayRow="false" ShowHeader="false"ShowFooter="false"ShowFullTime="true"MinutesPerRow="60"MultiDayView-ColumnHeaderDateFormat="dddd"StartInsertingInAdvancedForm="true"StartEditingInAdvancedForm="true"OverflowBehavior="Expand"<telerik:RadComboBox ID="radcbFrom" runat="server" DataSourceID="sdsFrom_WebSites" DataTextField="From_WebSite" DataValueField="From_WebSite" EnableEmbeddedSkins="false" Skin="BlackByMe" ValidationGroup="A" Width="240px" LoadingMessage="Loading ..." CausesValidation="False" MaxHeight="150px" AppendDataBoundItems="True" HighlightTemplatedItems="true" OnClientDropDownOpening="OnClientDropDownOpening" OnClientDropDownClosing="OnClientDropDownClosing" OnClientSelectedIndexChanging="OnClientSelectedIndexChanging" OnClientBlur="OnClientBlur"> <Items> <telerik:RadComboBoxItem runat="server" Text="All" Value="-1" /> </Items> <ItemTemplate> <asp:CheckBox runat="server" ID="CheckBox" onclick="checkboxClick();" Text='<%# DataBinder.Eval(Container, "Text") %>' /> </ItemTemplate></telerik:RadComboBox>AppendDataBoundItems="True"function RadContextMenu1_ItemClicked(sender, args) { args._item.set_selectedImageUrl("~/Images/Selected.png")}GridDataItem parentItem = (GridDataItem)e.DetailTableView.ParentItem;DataTable dt = (DataTable)e.DetailTableView.DataSource;e.DetailTableView.DataSource = dt.Select("BQRef == '" + parentItem["BQRef"].Text + "'");using System.Web.UI;using Telerik.Web.UI;namespace Telerik.Web.Examples.Scheduler.Default{ public partial class DefaultCS : System.Web.UI.Page { private const int AppointmentsLimit = 1; private bool ExceedsLimit(Appointment apt) { int appointmentsCount = 0; foreach (Appointment existingApt in RadScheduler1.Appointments.GetAppointmentsInRange(apt.Start, apt.End)) { if (existingApt.Visible) appointmentsCount++; } return (appointmentsCount > AppointmentsLimit - 1); } private bool AppointmentsOverlap(Appointment appointment) { if (ExceedsLimit(appointment)) { foreach (Appointment a in RadScheduler1.Appointments.GetAppointmentsInRange(appointment.Start, appointment.End)) { if (a.ID != appointment.ID) { return true; } } } return false; } private void RegisterScript() { Label1.Text = "Invalid move! There are appointments arranged for this time period."; ScriptManager.RegisterClientScriptBlock(this, GetType(), "LabelUpdated", "$telerik.$('.lblError').show().animate({ opacity: 0.9 }, 2000).fadeOut('slow');", true); } protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e) { if (ExceedsLimit(e.Appointment)) { e.Cancel = true; RegisterScript(); } } protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { if (AppointmentsOverlap(e.ModifiedAppointment)) { e.Cancel = true; RegisterScript(); } } protected void RadScheduler1_RecurrenceExceptionCreated(object sender, RecurrenceExceptionCreatedEventArgs e) { if(AppointmentsOverlap(e.ExceptionAppointment)) { e.Cancel = true; RegisterScript(); } } }}protected bool ExceedsLimit(Appointment apt) { foreach (Appointment existingApt in RadScheduler1.Appointments.GetAppointmentsInRange(apt.Start, apt.End)) { foreach (Resource existingRes in existingApt.Resources.GetResourcesByType("User")) { if (((apt.Resources.GetResource(existingRes.Type, existingRes.Key)) != null)) { return true; } } } return false; } private bool AppointmentsOverlap(Appointment appointment) { foreach (Appointment a in RadScheduler1.Appointments.GetAppointmentsInRange(appointment.Start, appointment.End)) { if (ExceedsLimit(appointment) && a.ID != appointment.ID) { return true; } } return false; } protected void RadScheduler1_AppointmentInsert(object sender, Telerik.Web.UI.SchedulerCancelEventArgs e) { if (ExceedsLimit(e.Appointment)) { Messages.Text = "This resource has already been scheduled for this time slot."; e.Cancel = true; } } protected void RadScheduler1_AppointmentUpdate(object sender, Telerik.Web.UI.AppointmentUpdateEventArgs e) { if (AppointmentsOverlap(e.ModifiedAppointment)) { Messages.Text = "This resource has already been scheduled for this time slot."; e.Cancel = true; } }