How to custimize the calendar form view on RadScheduler's navigation panel?

11 posts, 0 answers
  1. Alex
    Alex avatar
    32 posts
    Member since:
    May 2012

    Posted 28 Mar 2013 Link to this post

    Hi,

    I have one requirement. I want to highlight the days which has schedule events on RadScheduler's navigation panel. Could you give me some comments? Is there any event which I could use on navigation panel drop icon click?

    Alex
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 02 Apr 2013 Link to this post

    Hello Alex,

    I would suggest reviewing the following help article that demonstrates how you can highlight days which has schedule events in popup calendar. If this is not the functionality you are trying to achieve, please elaborate a bit more on your scenario.


    Regards,
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. Alex
    Alex avatar
    32 posts
    Member since:
    May 2012

    Posted 02 Apr 2013 Link to this post

    Hi Boyan,

    Yes, that's what I am expected. But I want to set the special days to be bold not the background color. Now I could get it worked with setting background color but setting the font to be bold cannot work. Even add "font-weight:bold !important" cannot make it work. Do you know why?

    RadCalendar popupCalendar = _view.ResourceScheduler.FindControl("SelectedDateCalendar") as RadCalendar;
                if (popupCalendar != null)
                {
                    foreach (Appointment a in _view.ResourceScheduler.Appointments)
                    {
                        RadCalendarDay dayWithAppointment = new RadCalendarDay();
                        dayWithAppointment.ToolTip = a.Subject;
                        dayWithAppointment.Date = a.Start;
                        dayWithAppointment.ItemStyle.Font.Bold = true;
                        popupCalendar.SpecialDays.Add(dayWithAppointment);
                    }
                }


    Alex
  5. Alex
    Alex avatar
    32 posts
    Member since:
    May 2012

    Posted 03 Apr 2013 Link to this post

    Hi Boyan,

    I have made it worked by adding class name ".DayWithAppointments a". But as you know, our appointments will be different every month, I cannot get all the appointments one time. So could you tell me what events should be used by clicking "<" and">"?

    Alex
  6. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 03 Apr 2013 Link to this post

    Hello,

    I would suggest adding a different class to your dayWithAppointment object based on some condition - in your case that might be the current appointment month. In the code snippet below, a css class "April" is added if the current appointment' month is April. The rest of the appointments will have "otherMonth" class. Following that pattern you can differentiate your appointments and apply different styles based on some conditions. 
    //markup code
    <telerik:RadScheduler runat="server" ID="RadScheduler1" OnPreRender="RadScheduler1_PreRender">        
    </
    telerik:RadScheduler>
    //code behind
    protected void RadScheduler1_PreRender(object sender, EventArgs e)
        {
            RadCalendar popupCalendar = RadScheduler1.FindControl("SelectedDateCalendar") as RadCalendar;
            if (popupCalendar != null)
            {
                popupCalendar.Skin = "Sunset";
     
                foreach (Appointment a in RadScheduler1.Appointments)
                {
                    RadCalendarDay dayWithAppointment = new RadCalendarDay();
                    dayWithAppointment.ToolTip = a.Subject;
                    dayWithAppointment.Date = a.Start;
                     
                    if (a.Start.Month == 4)
                    {
                        dayWithAppointment.ItemStyle.CssClass = "April";
                    }
                    else
                    {
                        dayWithAppointment.ItemStyle.CssClass = "otherMonth";
                    }          
                    popupCalendar.SpecialDays.Add(dayWithAppointment);
                }
            }
        }
    //css
    <style type="text/css">
           .RadCalendar .rcRow td.April a {
               color:red;
           }
           .RadCalendar .rcRow td.otherMonth a {
               color:blue;
           }
       </style>

    Kind regards,
    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.
  7. Alex
    Alex avatar
    32 posts
    Member since:
    May 2012

    Posted 06 Apr 2013 Link to this post

    Hi Boyan,

    Thanks for your comments. Maybe I am not clear. What I want is to highlight days which have appointments in RadCalendar form view on radScheduler.

    Now I could highlight days in mehtod "preRender". But if the month is changed by clicking navigation "<", the calender view will be changed and I should highlight days again. How could I do that? What events should I use when clicking "<" or ">" in server codes?

    Alex
  8. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 08 Apr 2013 Link to this post

    Hello,

    I would like to clarify that the event associated with clicking on next/previous month on the RadScheduler navigation panel is OnNavigationCommand. Here you may find more information about that specific event and its arguments.


    Kind regards,
    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.
  9. Alex
    Alex avatar
    32 posts
    Member since:
    May 2012

    Posted 08 Apr 2013 Link to this post

    Hi Boyan,

    I have noticed that. But when I adding NavigationCommand event, it always be called after selecting one date. It cannot be called when I click ">" or "<" on the navigation view. Do you know why?

    resourceScheduler.NavigationCommand += ResourceSchedulerNavigationCommand;


    Alex
  10. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 11 Apr 2013 Link to this post

    Hello,

    I would like to apologize for the misunderstanding in our communication.

    Your observations are absolutely correct, when user clicks on the RadScheduler embedded calendar previous/next month is not firing any event out of the box.
    Therefore I have prepared a sample project that implements the following scenario - in the server-side event Page_Load the RadScheduler embedded calendar is subscribed for the OnCalendarViewChanged client-side event. From that event handler using RadAjaxManager you can do a Ajax request in order to perform some modifications to the RadScheduler each time when user clicks  on previous/next month arrows on the embedded calendar.
    Please review the following links related to the RadCalendar client-side events and the RadAjaxManager AjaxRequest event

    Hope that this will be helpful.

    Kind regards,
    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.
  11. Alex
    Alex avatar
    32 posts
    Member since:
    May 2012

    Posted 12 Apr 2013 Link to this post

    Hi Boyan,

    Really thanks for your example. I have tried it could work. But in my codes, as it has many user controls in my codes and they are calling each other, they cannot work. All the server codes can be debuged with no error. Is this because our RadScriptManager is in Site.Master.cs file?

    Alex
  12. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 16 Apr 2013 Link to this post

    Hello Alex,

    Could you please explain what exactly is not working in your project? Please clarify is there any JavaScript errors that might cause the described unusual behavior?
    Our recommended approach is adding your RadScriptManager to the master page of your project, because only one instance of the RadScriptManager is allowed on a page.

    Please find here some detailed information about our RadScriptManager.

    Regards,
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017