This is a migrated thread and some comments may be shown as answers.

Cycling through months Events

3 Answers 53 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Kyle
Top achievements
Rank 2
Kyle asked on 12 Jun 2013, 08:06 AM
Hi.  I need some guidance with the Scheduler. Im basically retrieving a a list of records from the DB using the EF.  I am currently binding this to the scheduler and it works like a charm. I am also populating a grid view right under my scheduler with all the appointments irrelevant of what current month the scheduler is on.

Now, i have a new requirement whereby i only show the appointments in the grid and scheduler of the selected months. So i need to filter my results (list) when the user selects the left or right arrow to cycle through the months.  I will then need to identify the start date and end date of that month and filter with a where clause on the list i have in real time. 

What event must i use to be initiated once the user selects one of this arrows which will also provide me the next/previous months and their days?

Is this possible please? I have been searching many examples, though i keep finding examples of specific people that fit to their needs. I do feel that im close but cant get around it.

I am currently binding my scheduler this way and listing everything.. So i just need to do the same thing but filtering using a where clause in the entity framework by getting the start date and end date of the month the user has selected.
private void BindScheduler()
        {
            #region Scheduler
            List<AppointmentInfo> appList = new List<AppointmentInfo>();
 
            DateTime startDate, endDate; // Coming from the db, just removed the code below in the for loop.
            string name;
             
            for (int schedCount = 0; schedCount <= _groupScheduleList.Count - 1; schedCount++)
            {
                Appointment appSched = new Appointment();
 
                appSched.ID = schedCount;
                appSched.Start = startDate;
                appSched.End = endDate;
                appSched.Subject = name;
 
                AppointmentInfo appI = new AppointmentInfo(appSched);
 
                appList.Add(appI);
            }
 
            timeSlotScheduler.DataSource = appList;
            timeSlotScheduler.DataBind();
            #endregion
        }


Update:
Im going to see if i will manage using e.Command.ToString(); I will then know if i can add months or minus.. will see if i sort out what i need this way.

3 Answers, 1 is accepted

Sort by
0
Accepted
Boyan Dimitrov
Telerik team
answered on 17 Jun 2013, 09:54 AM
Hi,

An easy and convenient way of achieving such functionality would be use the RadScheduler NavigationCommand server-side event. This event is fired when user clicks on the left or right arrow in order to navigate to previous/ next time period. 
//markup code

<telerik:RadScheduler ID="RadScheduler1" runat="server"  OnNavigationCommand="RadScheduler1_NavigationCommand">
</telerik:RadScheduler>
//code behind
protected void RadScheduler1_NavigationCommand(object sender, SchedulerNavigationCommandEventArgs e)
    {
        if (e.Command == SchedulerNavigationCommand.NavigateToNextPeriod)
        {
            //here goes the custom logic if user has clicked on next period button (right arrow)
        }
        else if (e.Command == SchedulerNavigationCommand.NavigateToPreviousPeriod)
        {
            //here goes the custom logic if user has clicked on previous period button (left arrow)
        }
    }

Regards,
Boyan Dimitrov
Telerik
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 the blog feed now.
0
Kyle
Top achievements
Rank 2
answered on 18 Jun 2013, 10:54 AM
Thanks.. I had come up with a similar solution by converting e to string.. though this is much more straight forward.

thanks a lot :) Have implemented it.
0
Kyle
Top achievements
Rank 2
answered on 18 Jun 2013, 10:57 AM
Thanks... have implemented it this way.
Tags
Scheduler
Asked by
Kyle
Top achievements
Rank 2
Answers by
Boyan Dimitrov
Telerik team
Kyle
Top achievements
Rank 2
Share this question
or