Timeline selected date popupCalendar

4 posts, 0 answers
  1. Claudiu Dordea
    Claudiu Dordea avatar
    3 posts
    Member since:
    May 2009

    Posted 02 Oct 2012 Link to this post

    I have a RadScheduler set in timeline mode and I need to display a period of 3 days before and 30 behind a certain date.
    When I select the date on the date picker the actual selected date of the timeline has to be SelectedDate.AddDays(-3).
    I tried this:
    protected void dispTimeline_NavigationCommand(object sender, Telerik.Web.UI.SchedulerNavigationCommandEventArgs e)
                switch (e.Command)
                    case Telerik.Web.UI.SchedulerNavigationCommand.NavigateToPreviousPeriod:
                        dispTimeline.SelectedDate = dispTimeline.SelectedDate.AddDays(-1);
                        e.Cancel = true;
                    case Telerik.Web.UI.SchedulerNavigationCommand.NavigateToNextPeriod:
                        dispTimeline.SelectedDate = dispTimeline.SelectedDate.AddDays(1);
                        e.Cancel = true;
                    case SchedulerNavigationCommand.SwitchToSelectedDay:
                        dispTimeline.SelectedDate = e.SelectedDate.AddDays(-3);
                        e.Cancel = true;
                    case SchedulerNavigationCommand.NavigateToSelectedDate:
                        RadCalendar popupCalendar = dispTimeline.FindControl("SelectedDateCalendar") as RadCalendar;
                        dispTimeline.SelectedDate = popupCalendar.SelectedDate.AddDays(-3);
                        // this doesn't work either
                        //dispTimeline.SelectedDate = popupCalendar.FocusedDate;
                        e.Cancel = true;

     the SelectedDate of the popupCalendar is the same as the SelectedDate of the timeline and not the date I selected on the page.
    After the date is selected in the calendar picker the page does a postback so I tried grabbing the PreRender event of the timeline and see if there is the date that i selected somewhere in the event args but no luck.

    How can I find this date, currently if I select a date from the calendar no date is changed so maybe it is my fault so here is my timeline definition
    <telerik:RadScheduler ID="dispTimeline" runat="server" DataDescriptionField="Observations"
        DataEndField="ToDate" DataKeyField="ReservationID" DataSourceID="SqlDataSource1"
        DataStartField="FromDate" DataSubjectField="Description"
        DayEndTime="23:59:00" DayStartTime="00:00:00"
        EnableDescriptionField="True" FirstDayOfWeek="Monday"
        HoursPanelTimeFormat="H:mm" LastDayOfWeek="Sunday" SelectedView="TimelineView"
        TimeLabelRowSpan="1" TimeZoneID="GTB Standard Time" TimeZoneOffset="02:00:00"
        WorkDayEndTime="18:00:00" WorkDayStartTime="09:00:00" MinimumInlineFormHeight="200"
        OverflowBehavior="Expand" Localization-HeaderMultiDay="Work Week"
        ColumnWidth="50px" ShowViewTabs="False" OnNavigationCommand="dispTimeline_NavigationCommand"
        AllowDelete="False" AllowEdit="False" AllowInsert="False" OnAppointmentClick="dispTimeline_AppointmentClick"
        GroupingDirection="Vertical" OnDataBound="dispTimeline_DataBound" OnNavigationComplete="dispTimeline_NavigationComplete" SelectedDate="2012-10-01" OnPreRender="dispTimeline_PreRender">
        <AdvancedForm Modal="true" Enabled="False" />
            <telerik:ResourceType Name="grpTimeline" DataSourceID="dsGrup" KeyField="ID" TextField="Denumire" ForeignKeyField="" />
            <telerik:ResourceType KeyField="StatusID" Name="Status" TextField="Description" ForeignKeyField="StatusID" DataSourceID="dsStatus" />
            <telerik:ResourceStyleMapping Type="Status" Text="Rezervare" ApplyCssClass="rsCategoryGreen" />
            <telerik:ResourceStyleMapping Type="Status" Text="Contract in derulare" ApplyCssClass="rsCategoryRed" />
            <telerik:ResourceStyleMapping Type="Status" Text="Contract inchis" ApplyCssClass="rsCategoryBlue" />
            <telerik:ResourceStyleMapping Type="Status" Text="Contract facturat" ApplyCssClass="rsCategoryDarkBlue" />
            <telerik:ResourceStyleMapping Type="Status" Text="Alte rezervari" ApplyCssClass="rsCategoryYellow" />
            <telerik:ResourceStyleMapping Type="Status" Text="Indisponibil" BackColor="DarkGray" />
        <Localization HeaderMultiDay="Work Week"></Localization>
        <TimelineView HeaderDateFormat="dd.MMM.yyyy" NumberOfSlots="35" SlotDuration="1.00:00:00"
            UserSelectable="true" SortingMode="Global" ColumnHeaderDateFormat="dd.MMM" />
        <MultiDayView UserSelectable="false" />
        <DayView UserSelectable="false" />
        <WeekView UserSelectable="false" />
        <MonthView UserSelectable="false" />

    Thank you
  2. Boyan Dimitrov
    Boyan Dimitrov avatar
    2035 posts

    Posted 03 Oct 2012 Link to this post

    Hello Claudiu,

    Could you please clarify a bit more the scenario you are trying to achieve, so I can help you out? It seems that the provided project works fine with displaying 3 days before and 30 days after the selected date from the popup calendar.
    Here you can watch a video in debug mode that shows how you can access the selected date in OnNavigationCommand event using EventArgs e.SelectedDate and this way you are able to set your RadScheduler SelectedDate property to its value.

    I hope this information was helpful.

    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Claudiu Dordea
    Claudiu Dordea avatar
    3 posts
    Member since:
    May 2009

    Posted 04 Oct 2012 Link to this post

    Hi Boyan,
    Thanks for your reply,
    I am baffled that it works on your side, when I get into the OnNavigationCommand event e.SelectedDate is the same ast dispTimeline.Selected date. it never changes to the date I actually select.
    first I thought that I might have set the selectedDate somewhere else but after a quick search the only place where I set the date is in this function.
    you can see my own video here 

    I used Chrome and IE9 to test and Visual studio 2012 to code 
    Telerik.web.ui version is : v.2012.2.912.40 Dev
  4. Claudiu Dordea
    Claudiu Dordea avatar
    3 posts
    Member since:
    May 2009

    Posted 04 Oct 2012 Link to this post

    I found the problem and solved it.
    It was the grouping I have a function that updates the grouping on the timeline and at the end of that function I was doing this
    and this line was the problem got it out and it works good now, I wouldn't have found this bug but I noticed that You had no grouping on your timeline so when I got mine out it started working.

    So thank you
Back to Top