I am getting an error when trying to bind a timeslot view over multiple days. Sometimes it works, sometimes it doesn't. I've traced it down to the "NumberOfSlots" variable. When I bind certain data, it won't go over 250. However, with some data it works fine with a value of 2500. I've pasted below a code snippet of a page that return the error. Any ideas as what could be causing this?
Specified argument was out of the range of valid values. |
Parameter name: value |
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. |
Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. |
Parameter name: value |
Source Error: |
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace: |
[ArgumentOutOfRangeException: Specified argument was out of the range of valid values. |
Parameter name: value] |
System.Web.UI.WebControls.Unit..ctor(Double value, UnitType type) +8670187 |
System.Web.UI.WebControls.Unit.Percentage(Double n) +38 |
Telerik.Web.UI.AllDayAppointmentControl.GetWidth() +75 |
Telerik.Web.UI.AppointmentControl.CalculateSize() +75 |
Telerik.Web.UI.Scheduler.Views.AllDayLayout.CreateAppointmentControls(IEnumerable`1 slots, Boolean registerAppointmentControls) +1338 |
Telerik.Web.UI.Scheduler.Views.AllDayLayout..ctor(IEnumerable`1 slots, Boolean registerAppointmentControls, IComparer`1 appointmentComparer) +103 |
Telerik.Web.UI.Scheduler.Views.Timeline.TimelineLayout..ctor(IEnumerable`1 slots, Boolean registerAppointmentControls, IComparer`1 appointmentComparer) +45 |
Telerik.Web.UI.Scheduler.Views.Timeline.TimelineLayout..ctor(IEnumerable`1 slots, IComparer`1 appointmentComparer) +42 |
Telerik.Web.UI.Scheduler.Views.Timeline.RendererBase.CreateLayout(List`1 timeSlots) +83 |
Telerik.Web.UI.Scheduler.Views.Timeline.RendererBase.CreateInnerContentTable(Control container, IList`1 allTimeLineSlots) +332 |
Telerik.Web.UI.Scheduler.Views.Timeline.GroupedByResource.Renderer.CreateVerticalContent(SchedulerTopTable topTable) +404 |
Telerik.Web.UI.Scheduler.Views.Timeline.GroupedByResource.Renderer.GetInnerContent() +310 |
Telerik.Web.UI.Scheduler.Views.Timeline.GroupedByResource.Renderer.GetContent() +88 |
Telerik.Web.UI.RadScheduler.CreateContent() +221 |
Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource) +190 |
Telerik.Web.UI.RadScheduler.CreateChildControls() +33 |
System.Web.UI.Control.EnsureChildControls() +87 |
System.Web.UI.Control.PreRenderRecursiveInternal() +44 |
System.Web.UI.Control.PreRenderRecursiveInternal() +171 |
System.Web.UI.Control.PreRenderRecursiveInternal() +171 |
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842 |
<telerik:RadScheduler runat="server" ID="RadScheduler1" SelectedView="TimelineView" |
OnAppointmentDataBound="RadScheduler1_OnAppointmentDataBound" TimelineView-HeaderDateFormat="D" |
DataSourceID="dsEventsDataSource" Skin="Office2007" GroupBy="Room" GroupingDirection="Vertical" |
DayStartTime="08:00:00" DayEndTime="23:30:00" TimeZoneOffset="03:00:00" DataKeyField="Conf_ID" |
DataSubjectField="Conference_Name" DataStartField="Start" DataEndField="End" |
OverflowBehavior="Expand" ShowViewTabs="false" ColumnWidth="10px" Width="950px" |
Height="400px" CustomAttributeNames="Conf_ID" OnAppointmentCommand="RadScheduler1_OnAppointmentCommand" |
OnResourceHeaderCreated="RadScheduler1_ResourceHeaderCreated" RowHeight="40px" |
MultiDayView-NumberOfDays="2" RowHeaderWidth="100px" EnableDatePicker="false" |
ShowNavigationPane="false" AllowInsert="false" AllowEdit="false" AllowDelete="false"> |
<advancedform modal="true" /> |
<timelineview numberofslots="192" slotduration="0:15" columnheaderdateformat="h tt" |
timelabelspan="4" showinsertarea="false" /> |
<resourcetypes> |
<telerik:ResourceType KeyField="VideoEndPointId" Name="Room" TextField="Name" ForeignKeyField="VideoEndPointId" |
DataSourceID="dsRoomsDataSource" /> |
</resourcetypes> |
<resourceheadertemplate> |
<asp:LinkButton ID="btnRemove" runat="server" Text="X" CommandName="RemoveResource" |
CausesValidation="false" CssClass="ui-icon ui-icon-trash" Style="float: left" |
OnClientClick="return confirm('Are you sure you want to remove this room?')" /> |
<asp:Label ID="ResourceLabel" runat="server" /> |
</resourceheadertemplate> |
</telerik:RadScheduler> |
<asp:LinqDataSource ID="dsEventsDataSource" runat="server" OnSelecting="dsEventsDataSource_OnSelecting"> |
</asp:LinqDataSource> |
<asp:LinqDataSource ID="dsRoomsDataSource" runat="server" OnSelecting="dsRoomsDataSource_OnSelecting"> |
</asp:LinqDataSource> |
public partial class Test4 : System.Web.UI.Page |
{ |
public List<Glowpoint.VNOC.BusinessLayer.Room> Rooms { get { return (List<Glowpoint.VNOC.BusinessLayer.Room>)ViewState["Rooms"]; } set { ViewState["Rooms"] = value; } } |
protected void Page_Load(object sender, EventArgs e) |
{ |
if (!Page.IsPostBack) |
{ |
RadScheduler1.SelectedDate = DateTime.Parse("10/15/2009"); |
TimeSpan daySpan = DateTime.Parse("10/19/2009 6:30:00 AM") - RadScheduler1.SelectedDate; |
RadScheduler1.TimelineView.NumberOfSlots = (daySpan.Days + 1) * 96; |
Rooms = new List<Glowpoint.VNOC.BusinessLayer.Room>() |
{ |
new Glowpoint.VNOC.BusinessLayer.Room() { |
VideoEndPointId = new Guid("95d15340-a38b-4c06-970e-290019f2d7fb"), |
Name = "test1", |
Schedules = new List<RoomSchedule>() { new RoomSchedule() { Conference_Name = "TPX 2.0 Upgrade", PreTestTime = DateTime.Parse("10/15/2009 6:45:00 AM"), Start = DateTime.Parse("10/15/2009 7:00:00 AM"), End = DateTime.Parse("10/19/2009 6:30:00 AM"), Conf_ID = 158062, VideoEndPointId = new Guid("95d15340-a38b-4c06-970e-290019f2d7fb") } } |
} |
}; |
} |
} |
protected void RadScheduler1_OnAppointmentCommand(object sender, AppointmentCommandEventArgs e) |
{ |
if (e.CommandName == "RemoveResource") |
{ |
Guid roomId = new Guid(e.CommandArgument.ToString()); |
Rooms.Remove(Rooms.Single(r => r.VideoEndPointTypeId == roomId)); |
RadScheduler1.Rebind(); |
System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "", "RemoveRoom('" + roomId + "');", true); |
} |
} |
protected void RadScheduler1_ResourceHeaderCreated(object sender, Telerik.Web.UI.ResourceHeaderCreatedEventArgs e) |
{ |
((Label)e.Container.FindControl("ResourceLabel")).Text = e.Container.Resource.Text; |
((LinkButton)e.Container.FindControl("btnRemove")).CommandArgument = e.Container.Resource.Key.ToString(); |
} |
protected void dsEventsDataSource_OnSelecting(object sender, LinqDataSourceSelectEventArgs e) |
{ |
List<RoomSchedule> schedules = new List<RoomSchedule>(); |
foreach (var room in Rooms) { schedules.AddRange(room.Schedules); } |
e.Result = schedules; |
} |
protected void RadScheduler1_OnAppointmentDataBound(object sender, SchedulerEventArgs e) |
{ |
if (e.Appointment.Subject == String.Empty) e.Appointment.BackColor = System.Drawing.Color.Red; |
} |
protected void dsRoomsDataSource_OnSelecting(object sender, LinqDataSourceSelectEventArgs e) |
{ |
e.Result = Rooms; |
} |
} |