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

Switching Month to Day View

3 Answers 100 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
MikeK
Top achievements
Rank 1
MikeK asked on 08 Oct 2008, 08:59 PM
How do I go about doing this?

I have a scheduler showing the appointments which are bound to a date range for a given month, with two other bindings (provider and location). If I switch from Month to Day view, the control displays the appointments for the current date.

What I need it to do is to allow the user to select the date from the Month view, then bind the data based on the selected date. Example:  the user navigates three months from today, then selects the 25th of that month, then selects Day view. I need the appointments for the 25th of January 2009 to be displayed. When they switch back to Month view, it would display all of January 2009.

I don't see server-side events to handle the single click for selection, and I can't figure out how to make the client-side events work with the server-side. I can grab the selected date clients-side, but I'm stuck at this point.

Help is greatly appreciated!

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 09 Oct 2008, 12:26 PM
Hello Michael,

Maybe you can use the Optimized Queries online example. Let us know if you need further help with this scenario.


Kind regards,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
MikeK
Top achievements
Rank 1
answered on 09 Oct 2008, 12:43 PM
That will help for part of what I'm trying to do but doesn't address the main issue, switch the displayed date in Day view to what I've selected from the month view.

From the demo you listed, switch to Month view and click once on the 5th, then switch to Day view. I need the schedule to display the listing from the 5th. It is displaying March 30th which requires the user to either use the calendar popup or keep clicking the back arrow.

Is there a way to capture what the user selected and feed it to the calendar so "today" becomes this value?
0
Peter
Telerik team
answered on 09 Oct 2008, 02:38 PM

You can use RadAjaxManager to store the clicked time slot in the ViewState. Then, in NavigationCommand set the SelectedDate for RadScheduler to the value stored in the ViewState. Here is the sample code:

aspx:
<telerik:RadCodeBlock id="RadCodeBlock1" runat="server">      
    <script type="text/javascript">         
        function OnClientTimeSlotClick(sender, eventArgs)   
        {  
            if (sender.get_selectedView() == Telerik.Web.UI.SchedulerViewType.MonthView)   
            {                 
                var selectedDate = eventArgs.get_time().format('yyyy/MM/dd');  
                $find("<%=RadAjaxManager1.ClientID %>").ajaxRequest(selectedDate)  
            }           
        }  
    </script> 
    </telerik:RadCodeBlock> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"   
        onajaxrequest="RadAjaxManager1_AjaxRequest">         
    </telerik:RadAjaxManager>      
    <telerik:RadScheduler ID="RadScheduler1" 
        OnClientTimeSlotClick="OnClientTimeSlotClick" 

code-behind:
 protected void RadScheduler1_NavigationCommand(object sender, SchedulerNavigationCommandEventArgs e)  
    {  
       if ((e.Command == SchedulerNavigationCommand.SwitchToDayView)&(ViewState["selectedDate"] != null))  
            RadScheduler1.SelectedDate = DateTime.Parse(ViewState["selectedDate"].ToString());  
    }  
    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)  
    {  
        ViewState["selectedDate"] = e.Argument;       
          
    } 




Best wishes,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Scheduler
Asked by
MikeK
Top achievements
Rank 1
Answers by
Peter
Telerik team
MikeK
Top achievements
Rank 1
Share this question
or