Special Days style

14 posts, 0 answers
  1. Voss Grose
    Voss Grose avatar
    81 posts
    Member since:
    Sep 2012

    Posted 25 Jan 2009 Link to this post

    Once I set the SpecialDays collection they are styled correctly, but as soon as I hover over them I guess they go back to their hover style.

    How do I make the SpeicalDays style stick?

    CODE BELOW:

    <asp:ScriptManager id="ScriptManager" runat="server" />
     <telerik:radajaxmanager id="RadAjaxManager1" runat="server">
                    <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="RadCalendar1">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="RadCalendar1"></telerik:AjaxUpdatedControl>
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                    </AjaxSettings>
                </telerik:radajaxmanager>
                <telerik:radcalendar
                    id="RadCalendar1"
                    runat="server"
                    Skin="Black"
                    AutoPostBack="true"
                    MultiViewColumns="2"
                    MultiViewRows="2"
                    EnableMultiSelect="false"
                    EnableViewState="true"
                    OnSelectionChanged="RadCalendar1_OnSelectionChanged"
                    TitleFormat="MMMM yyyy"
                    CultureInfo="English (United States)"  
                    >
                    <DisabledDayStyle BorderColor="#573d08" BackColor="#573d08" CssClass="SelectedClass" />
                </telerik:radcalendar>




    for (Int16 x = 0; x <= Math.Abs(ts.TotalDays); x++)
            {
                RadCalendarDay spec = new RadCalendarDay();
                DateTime dateV = StartDate.Value.AddDays(x);
                spec.Date = dateV;
                spec.IsSelectable = true;
                spec.IsDisabled = true;
                //spec.IsSelected = true;
                RadCalendar1.SpecialDays.Add(spec);  
            }
  2. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 26 Jan 2009 Link to this post

    Hello Voss,

    This is an integration problem with RadCalendar and RadAjax. Please use regular asp:UpdatePanels to ajaxify RadCalendar. Sorry about the inconvenience.

    Greetings,
    Dimo
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Voss Grose
    Voss Grose avatar
    81 posts
    Member since:
    Sep 2012

    Posted 30 Jan 2009 Link to this post

    I'm not sure what I'm doing wrong, but I can't get this issues resolved.
    Whenever I hover over the days they lose their formatting that was applied.
    CS
     protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DateTime startDate = DateTime.Now;
                for (Int16 x = 0; x <= 10; x++)
                {
                    RadCalendarDay spec = new RadCalendarDay();
                    DateTime dateV = startDate.AddDays(x);
                    spec.Date = dateV;
                    spec.IsSelectable = true;
                    spec.IsDisabled = true;
                    RadCalendar1.SpecialDays.Add(spec);
                }

            }
        }
    ASPX:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test2.aspx.cs" Inherits="Test2" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
        <link href="css/Default.css" rel="stylesheet" type="text/css" />
    </head>
      <body class="BODY">
            <form id="Form1" method="post" runat="server">

                <asp:ScriptManager id="ScriptManager" runat="server" />
                <asp:UpdatePanel ID="upCalendar" runat="server">
                    <ContentTemplate>
                    <telerik:radcalendar
                    id="RadCalendar1"
                    runat="server"
                    Skin="Black"
                    AutoPostBack="true"
                    MultiViewColumns="2"
                    MultiViewRows="2"
                    EnableMultiSelect="false"
                    EnableViewState="true"
                    TitleFormat="MMMM yyyy"
                    CultureInfo="English (United States)"  
                    >
                    <DisabledDayStyle BackColor="#573d08" BorderStyle="Solid" BorderWidth="1px" BorderColor="#000000" CssClass="DisabledClass" />
                </telerik:radcalendar>
                    <div>
                    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="upCalendar" DisplayAfter="100" DynamicLayout="true">
                        <ProgressTemplate>
                            <img border="0" src="images/ajax-loader-circle.gif"" />
                        </ProgressTemplate>                    
                    </asp:UpdateProgress>
                    </div>
                </ContentTemplate>             
                </asp:UpdatePanel>
                <br />

                </form>
        </body>
    </html>

  5. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 02 Feb 2009 Link to this post

    Hi Voss,

    Could please be more specific when and where you are applying the desired formatting on RadCalendar? Then I could follow your steps and perform further investigations on the issue you are facing.

    Looking forward your reply,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Voss Grose
    Voss Grose avatar
    81 posts
    Member since:
    Sep 2012

    Posted 02 Feb 2009 Link to this post

                    <DisabledDayStyle BackColor="#573d08" BorderStyle="Solid" BorderWidth="1px" BorderColor="#000000" CssClass="DisabledClass" />

    Which gets applied against the special days collection.
  7. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 03 Feb 2009 Link to this post

    Hi Voss,

    Indeed, this is the expected behavior of RadCalendar.
    However, going through you code again, I can see that you a setting your special days as selectable and disabled same time. Usually, when day in RadCalendar is set as disabled it is meant to be non selectable.
    Therefore I suggest that you set the selectable days as enabled.
    Additionally, you could use the ItemStyle property of the RadCalendarDay to set custom style of your special days.

    I hope this helps.

    Kind regards,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. Voss Grose
    Voss Grose avatar
    81 posts
    Member since:
    Sep 2012

    Posted 07 Feb 2009 Link to this post

    do you have a simple example of how to do that?

    I'm trying to accomplish the following:
    1. Allow user to select 2 dates (range..start and end date)
    2. I highlight the date range in a different style (currently using the special days collection)
    3. When the user hovers over the dates the days should not loose their style (this seems to be a bug).

    #1 and #2 currently works. It's the hover over problem that is the issue.
  9. Shaun
    Shaun avatar
    18 posts
    Member since:
    May 2008

    Posted 09 Feb 2009 Link to this post

    This is very frustrating. We requested info on this the other day as well. Why don't you provide an actual solution to the integration problem rather than saying, oh - just use an update panel.

    The problem is specific the CUSTOM STYLES DO NOT WORK.

    What use is a CALENDAR object if you can't actually highlight a particular day. How would I link the Day_Render event up to the panel.

    This is a known bug - problem - where is the solution?

  10. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 10 Feb 2009 Link to this post

    Hello,

    I am afraid that the integration problem with RadAjax and RadCalendar cannot be solved or worked around with the current implementation of the two controls. Some further research and code rework is required. We will do our best to fix the problem for a future version of RadControls. Please excuse us for the inconvenience.

    Kind regards,
    Dimo
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  11. Shaun
    Shaun avatar
    18 posts
    Member since:
    May 2008

    Posted 10 Feb 2009 Link to this post

    Thanks. One thing I appreciate about Telerik is at least being told the truth about issues (all developers know they can exist) rather than being hesitant like many other suppliers.

    However, I am a little unsure what you mean by, "Some further research and code rework is required.".

    Do you mean at my end - or yours? If at yours, no problem, but if at mine - do you have any hints?

    Don't forget this Calendar is within the ASP.NET AJAX suite - so, its a bit odd that it is NOT compatible with AJAX, and there doesn't seem to be many options available to enable it, or get around some of the issues.

    I'm sure you know, but it is a pain, we had completely implemented a calendar in docks, within a split bar, with everything all working perfectly, only in the end to find you can't effectively use any ajax on the entire page because the calendar forgets everything (if anything on the page posts) and can't plot items on the calendar.

    Anyways, we've sort of got around it for the moment by using traditional postback, but its ugly and really hope this is a priority for your guys.

    Thanks!
  12. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 10 Feb 2009 Link to this post

    Hello Shaun,

    I meant to say that some research is required on our end.  Thanks for the understanding.

    Greetings,
    Dimo
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  13. Axel
    Axel avatar
    41 posts
    Member since:
    Jul 2009

    Posted 12 Aug 2009 Link to this post

    Acc. to the above thread this problem "selection lost after hovering over a special day" exists when using RadAjax with the RadCalendar control??
    I however have this same problem while not using the RadAjax control. I am using a regular .Net Ajax Updatepanel. I assign my special days "holidays" in code-behind incl. my "CalendarHolidays" class.

    This Server Side Code is called from PageLoad()
    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;  // for custom days  
            cnt++;  
            myDays[cnt] = oneDay;  
              
        }  
    }  
     
    if (cnt > 0)  
        RadCalendar1.SpecialDays.AddRange(myDays); 


    My custom css class
    .CalendarHolidays a  
    {  
        color: red !Important;  
        font-weight: bold !Important;  
        background-color: #f2f2f2 !Important;  

    And finally my html calendar code
    <telerik:RadCalendar ID="RadCalendar1" Runat="server" AutoPostBack="True" 
            DayNameFormat="Short"   
            font-names="Arial,Verdana,Tahoma" forecolor="Black" MultiViewColumns="3"   
            Skin="Hay" style="border-color: #ececec"   
            ViewSelectorText="x" EnableNavigationAnimation="True" 
    EnableViewSelector="True"   
            CssClass="RadCalendarMultiView_Hay" FastNavigationStep="4"   
            ShowOtherMonthsDays="False">  
        </telerik:RadCalendar> 


    Any idea what is wrong here? Am I missing something in my css code?
  14. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 18 Aug 2009 Link to this post

    Hi Axel,

    Try setting IsSelected = true to the special days in Page_Load. In this case the selected styles will not be lost upon hovering. As far as I can see, this works with RadAjax as well:


    <%@ Page Language="C#" %> 
    <%@ Import Namespace="System.Collections.Generic" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <script runat="server"
     
        public DateTime[] specialDates = { DateTime.Now, DateTime.Now.AddDays(-2), DateTime.Now.AddDays(2) }; 
         
        protected void Page_Load(object sender, EventArgs e) 
        { 
            int cnt = 0
            List<RadCalendarDay> myDays = new List<RadCalendarDay>(); 
            foreach (DateTime c in specialDates) 
            { 
                RadCalendarDay oneDay = new RadCalendarDay(); 
                oneDay.Date = c
                oneDay.ToolTip = c.ToShortDateString(); 
     
                oneDay.ItemStyle.CssClass = "CalendarHolidays"
                 
                if (RadCalendar1.SelectedDates.Contains(new RadDate(c))) 
                { 
                    oneDay.IsSelected = true
                } 
                 
                myDays.Add(oneDay); 
            } 
            RadCalendar1.SpecialDays.AddRange(myDays.ToArray());  
        } 
     
    </script> 
     
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head runat="server"
    <meta http-equiv="content-type" content="text/html;charset=utf-8" /> 
    <title>RadControls for ASP.NET AJAX</title> 
    <style type="text/css"
     
    .CalendarHolidays a   
    {   
        color: red !Important;   
     
    </style> 
    </head> 
    <body> 
    <form id="form1" runat="server"
    <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
     
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Transparency="50" BackColor="Yellow" /> 
     
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadCalendar1"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadCalendar1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
     
    <%--<asp:UpdatePanel ID="UpdatePanel1" runat="server"
    <ContentTemplate> 
    --%> 
     
    <telerik:RadCalendar ID="RadCalendar1" runat="server" AutoPostBack="True" MultiViewColumns="2" /> 
     
    <%--</ContentTemplate> 
    </asp:UpdatePanel>--%> 
     
         
    </form> 
    </body> 
    </html> 


    Greetings,
    Dimo
    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. Joe
    Joe avatar
    1 posts
    Member since:
    Jul 2011

    Posted 23 Nov 2011 Link to this post

    Please disregard below text.... it does work. Sorry!

    Has this ever been solved other than setting all of the SpecialDays to IsSelected=true in Page_Load?

    This post is nearly three years old. I have the latest/greatest version of ASP.NET AJAX controls and the calendar losing its formatting on a hover-over still seems to be an issue.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017