Error when binding timeslot view

5 posts, 1 answers
  1. Ron Cirka
    Ron Cirka avatar
    19 posts
    Member since:
    Jul 2009

    Posted 08 Sep 2009 Link to this post

    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?')" />&nbsp; 
                    <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(thisthis.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; 
        } 

  2. Answer
    Peter
    Admin
    Peter avatar
    6637 posts

    Posted 11 Sep 2009 Link to this post

    Hi Ron,

    We tested your code (slightly modified) with our own datasource, but we could not replicate the problem. Please, see the attached sample for reference. To be able to assist you further, please open a support ticket and send us a working demo that we can test locally.


    Kind regards,
    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Ron Cirka
    Ron Cirka avatar
    19 posts
    Member since:
    Jul 2009

    Posted 11 Sep 2009 Link to this post

    Thanks, I have sent a support ticket.
  4. Josh
    Josh avatar
    42 posts
    Member since:
    May 2009

    Posted 30 Mar 2011 Link to this post

    Dear Support,

    I have a similar problem except the binding error occurs when I attempt to bind more than 364 records. 

    Can I view the solution that was offered to the original poster of this thread?  Or can someone explain how to get around this limitation?

    Thanks,
    Josh
  5. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 31 Mar 2011 Link to this post

    Hello Josh,

    When Peter debugged the application of Ron, he found that Ron is setting NumberOfSlots to a value larger than 2000 (not 200). 2000 is a way too many slots for RadScheduler to render. The maximum number that you can set NumberOfSlots to is 359, which Peter found empirically. Our suggestion is to reorganize RadScheduler in such a way as to not to exceed this number.

    All the best,
    Veronica Milcheva
    the Telerik team
Back to Top