keep highligted days format

14 posts, 0 answers
  1. Magnus Modig
    Magnus Modig avatar
    4 posts
    Member since:
    Jan 2008

    Posted 21 Jun 2008 Link to this post

    Hi

    I use the dayrender event to make days that have a event associated to have a different background color. The calender is set to autopostback so when I click a highlighted day, I fetch that days event from a database. But when I click the day and the postback occurs the format of the highlited days disapers, it did not help to set  "if not page.ispostback" for the specific dayrender code either. How can I keep my format for the higlighted days that have an event associated to it?

    Best Regards 
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 23 Jun 2008 Link to this post

    Hi Magnus,

    I suggest that you define Special Days Templates for different types of events as shown in this online demo. And then add the days with events to the Special Days collection of the calendar and assign them appropriate templates.

    Find more information on how to add special days dynamically at the bottom of this help topic.
     
    Let us know if these directions are helpful.

    Greetings,
    Iana
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. James Keller
    James Keller avatar
    6 posts
    Member since:
    Jul 2008

    Posted 14 Jul 2008 Link to this post

    I having this same problem.  Your example http://www.telerik.com/demos/aspnet/prometheus/Calendar/Examples/Programming/CustomDayCellRendering/DefaultCS.aspx even has this bug.  The server mode calendar colors the day, but as soon as you click/select a day then hover over the colored day it disappears. I've got a 2x2 grid of months displayed. I'm trying to highlight a range of days that I want a user to select from.  Multiselect is an option.  Your option for doing special days only works if you set IsSelectable to false.  Do you have any way of making the colored backgrounds stay colored? I'm using the new 2008 AJax controls. 
  5. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 15 Jul 2008 Link to this post

    Hi James Keller,

    Unfortunately it is a known issue that calendar cell styles set on DayRender are not applied properly after ajax request when RadCalendar is ajaxified with RadAjax. This is due to the DayRender event fires too late, after RadAjax has already been updated the calendar.

    A possible workaround is to ajaxify your calendar via asp UpdatePanel instead of using RadAjax.
    Another option is to add your highlighted days to the SpecialDays collection of the calendar on Page_Load for instance.

    Let us know how it goes.

    Regards,
    Iana
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. James Keller
    James Keller avatar
    6 posts
    Member since:
    Jul 2008

    Posted 15 Jul 2008 Link to this post

    The normal Ajax Update panel worked perfect so far.  Thanks for your help.
  7. bonny
    bonny avatar
    4 posts
    Member since:
    Jul 2008

    Posted 17 Jul 2008 Link to this post

    Actually I m getting same kind of problem.
    I m using radcalendar and in day render event i m programmatically change the color of dates like 5,10,15 etc of all month of all years so it shows me different color but after that when I move mouse over that dates which r in different color(5,10,15) I lose the color for that dates so its worthless for me could u just help me out soon its very urgent

    Thanks
    Bonny
  8. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 18 Jul 2008 Link to this post

    Hello bonny,

    Have you tried ajaxifying your RadCalendar via MS UpdatePanel instead of using RadAjax to check if this helps?
    Another option for solving your problem would be using special days templates for your colored days as shown in this online demo.

    Give it a spin and let us know how it goes.

    Best wishes,
    Iana
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  9. Axel
    Axel avatar
    41 posts
    Member since:
    Jul 2009

    Posted 12 Aug 2009 Link to this post

    I am using the .net Updatepanel and have the same problem. My special day selection is lost after I hover over that day. I however found out that this behavior only exists if I set the RadCalendar control to autopostback. If I remove autopostback then selection is undamaged.
    But now the plot tickens because I am using MultiViewColumns=3 i.e. displaying 3 months at a time. And here in this forum I found out that autopostback is necessary for navigation to work when using MultiViewColumns. So I have a catch 22 here. If I use autopostback then I loose special day selection after hover, and if I set autopostback to false then I loose navigation.

    Is there a way out of this mess?

    Thank god I'm still evaluating :-)
    thanks
    Axel
  10. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 17 Aug 2009 Link to this post

    Hello Axel,

    Indeed, using UpdatePanel for ajaxifying RadCalendar should not spoil the special days styling. However, could you please try removing any ajax and see if it works properly with regular postbacks?
    It would be great if you can send me a sample project illustrating your scenario and setup.

    Kind regards,
    Iana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  11. Axel
    Axel avatar
    41 posts
    Member since:
    Jul 2009

    Posted 17 Aug 2009 Link to this post

    Hi Lana

    Just to be clear, I am not loosing my special days formatting. I am loosing my special day selection style after hovering over a selected special day.
    I tried removing the ajax like you said and just use regular postback but with the same results. No change. The Page does it's postback when I select a special day, but when I hover over that selection the style disappears leaving me with an unselected special day style.

    Here is my code:
    html

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AbsenceCalendar.ascx.cs" Inherits="hv.Absence.AbsenceCalendar" %> 
    <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
    <asp:Panel id="UserControlContainer" CssClass="UserControlContainer" runat="server">  
    <telerik:RadCalendar ID="RadCalendar1" Runat="server" AutoPostBack="True" 
            CultureInfo="Icelandic (Iceland)" DayNameFormat="Short" WeekendDayStyle-CssClass="WeekendDayStyle"   
            font-names="Arial,Verdana,Tahoma" forecolor="Black" MultiViewColumns="3"   
            Skin="Hay" style="border-color: #ececec"   
            CssClass="RadCalendarMultiView_Hay">  
            <WeekendDayStyle CssClass="WeekendDayStyle" /> 
        </telerik:RadCalendar> 
    </asp:Panel> 

    codebehind:
    On PageLoad
     
                    if (!Page.IsPostBack)  
                    {  
                        LoadHolidays();  
                          
                    } 
           protected void LoadHolidays()  
            {  
                // ling to SQl  
                SystemManagementDataContext smd = new SystemManagementDataContext();  
     
                var rec = smd.GetAllHolidays().ToList();  
     
                int cnt = -1;  
     
                if (rec != null)  
                {  
                    RadCalendarDay[] myDays = new RadCalendarDay[rec.Count()];  
                    foreach (CalendarHoliday c in rec)  
                    {  
                        if (c.holidaydate.HasValue)  
                        {  
                            RadCalendarDay oneDay = new RadCalendarDay();  
                            oneDay.Date = c.holidaydate.Value;  
                            oneDay.ToolTip = c.holidayname;  
                              
                            if (string.IsNullOrEmpty(c.cssclass))  
                                oneDay.ItemStyle.CssClass = "CalendarHolidays";  
                            else  
                                oneDay.ItemStyle.CssClass = c.cssclass;  
                            cnt++;  
                            myDays[cnt] = oneDay;  
                              
                        }  
                    } 




  12. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 18 Aug 2009 Link to this post

    Hello Axel,

    I appreciate your efforts. As the calendar behaves the same way with no ajax, we can at least isolate the issue to the extend that the ajax is not the reason.
    I went through your code and I was not able to find there the place you are adding the holiday days to SpecialDays collection of the calendar. Could you please try modifying your code as below and see if it works this way:

    protected void LoadHolidays()     
            {     
                // ling to SQl     
                SystemManagementDataContext smd = new SystemManagementDataContext();     
        
                var rec = smd.GetAllHolidays().ToList();     
        
                int cnt = -1;     
        
                if (rec != null)     
                {     
                    RadCalendarDay[] myDays = new RadCalendarDay[rec.Count()];     
                    foreach (CalendarHoliday c in rec)     
                    {     
                        if (c.holidaydate.HasValue)     
                        {     
                            RadCalendarDay oneDay = new RadCalendarDay();     
                            oneDay.Date = c.holidaydate.Value;     
                            oneDay.ToolTip = c.holidayname;     
                                 
                            if (string.IsNullOrEmpty(c.cssclass))     
                                oneDay.ItemStyle.CssClass = "CalendarHolidays";     
                            else     
                                oneDay.ItemStyle.CssClass = c.cssclass;     
                            cnt++;     
                            myDays[cnt] = oneDay;     
                            RadCalendar1.SpecialDays.Add(oneDay);        
                        }                         
                    }    
     

    Let me know how it goes.

    Greetings,
    Iana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  13. Axel
    Axel avatar
    41 posts
    Member since:
    Jul 2009

    Posted 18 Aug 2009 Link to this post

    Hi again,

    Sorry but I must have dropped these two lines of code that follow right after the loop. I am adding a range, not one by one.

     

    if (cnt > 0)  
        RadCalendar1.SpecialDays.AddRange(myDays); 

    Thanks to Dimo (Telerik) I solved this issue by removing autopostback and use this clientside thingy instead.
        function CalendarViewChanging(sender, eventArgs) {  
            var step = eventArgs.get_step();  
            if (step < 0)  
                __doPostBack("<%= RadCalendar1.UniqueID %>", "n:-1");  
            else  
                __doPostBack("<%= RadCalendar1.UniqueID %>", "n:1");  
        }  
         

    See also post #186810
  14. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 20 Aug 2009 Link to this post

    Hi Axel,

    I modified my code according to the latest provided information but still am not able to replicate the issue with the mouse hover. Could you please try it and let me know how it works on your end and if I missed something from your logic out?

    Greetings,
    Iana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  15. Brown
    Brown avatar
    48 posts
    Member since:
    Dec 2010

    Posted 10 Jan 2011 Link to this post

    Hi Magnus,

     I need small doubt to get the holidays from database and to display on the radcalendar.. i have a stored procedure for list of holidays monthly basis..in that radcalendar page.how can i display those holiday values from database.. to on the particular date on the month basis.. tell me how to do this
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017