RadCalendar Special Days Problem

5 posts, 0 answers
  1. omer
    omer avatar
    1 posts
    Member since:
    Jul 2012

    Posted 11 Jan 2011 Link to this post

    Hi to all

    this is my code how to generate special days in code behind

    private void Page_Load(object sender, EventArgs e)
        {
            var dc =
                new takvimDataContext(
                    "Data Source=xxx;");
            var sDays = from tkvm in dc.takvims
                        where
                            tkvm.tarih.Year == RadCalendar1.Calendar.GetYear(RadCalendar1.CalendarView.ViewStartDate)
                        select tkvm;
      
            foreach (var day in sDays)
            {
                var rcd = new RadCalendarDay {Date = day.tarih,TemplateID = "tatil"};
      
      
                RadCalendar1.SpecialDays.Add(rcd);
                var cl = RadCalendar1.Calendar;
                      
            }

    and my problem is

     

    i cant display specials days numbers in calendar
    they are all empty (In template i make red background to specials days to see are they working ?)
    when i try to fill them in template

     

    <CalendarDayTemplates>
                <telerik:DayTemplate ID="tatil" runat="server">
                    <Content>
                      
                        <div style="background-color:Red">
                            <%= RadCalendar1.????????????%>
                        </div>
                    </Content>
                </telerik:DayTemplate>
            </CalendarDayTemplates>

    How can i show the current date in special days collection ?

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 14 Jan 2011 Link to this post

    Hi Omer,

    Note that the required functionality could not be achieved with RadCalendar special days. The only possible way is to manually add the date to each specific template like this:
    <CalendarDayTemplates>
               <telerik:DayTemplate ID="DateTemplate" runat="server">
                   <Content>
                       <div class="rcTemplate rcDayDate">
                           1
                       </div>
                   </Content>
               </telerik:DayTemplate>


    Kind regards,
    Maria Ilieva
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 14 Jan 2011 Link to this post

    Hi Omer,

    Note that the required functionality could not be achieved with RadCalendar special days. The only possible way is to manually add the date to each specific template like this:
    <CalendarDayTemplates>
               <telerik:DayTemplate ID="DateTemplate" runat="server">
                   <Content>
                       <div class="rcTemplate rcDayDate">
                           1
                       </div>
                   </Content>
               </telerik:DayTemplate>


    Kind regards,
    Maria Ilieva
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  5. Support@silverbear.com
    Support@silverbear.com avatar
    3 posts
    Member since:
    Jul 2010

    Posted 28 Jun 2011 Link to this post

    Actually, there is a way to do this..

    In the template, create some tokens to represent day specific data.. like this:-

    <CalendarDayTemplates>
               <telerik:DayTemplate ID="DateTemplate" runat="server">
                   <Content>
                       <div class="rcTemplate rcDayDate">
                           {DayOfMonth}
                       </div>
                   </Content>
               </telerik:DayTemplate>

    Then in the DayRender event handler, simply replace tokens based on currently rendered day:-

       protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
            {
                // Do a token replace..
                e.Cell.Text = e.Cell.Text.Replace("{DayOfMonth}", e.Day.Date.Day.ToString());
         
            }

    I hope that helps anyone who has stumbled accross this problem..

    Darrell @ Silverbear
  6. Guillaume
    Guillaume avatar
    1 posts
    Member since:
    Sep 2015

    Posted 16 Sep 2015 in reply to Support@silverbear.com Link to this post

    Well thank you! You saved my day. It works well.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017