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

SpecialDays at runtime not firing Template

8 Answers 104 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Pierre
Top achievements
Rank 1
Pierre asked on 15 Jun 2010, 02:07 AM
Hi Team,

I have problems to fire templatesID added as markups at runtime using demo samples. The TemplateID MondayTemplate are not fired but the item is marked as Special days in render. TemplateId are only working if specialDays are added as markup in the initial page like DateTemplate. Special days(as markup or runtime) are lost after paging need some event to reload?. Could you reproduce and help us? Regards

 <telerik:RadCalendar  ID="RadCalendar1" runat="server" Skin="Special" EnableMultiSelect="true" FirstDayOfWeek="Monday" UseRowHeadersAsSelectors ="true" 
            EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false" EnableMonthYearFastNavigation="false" DayNameFormat="Short" 
            ShowRowHeaders="true" ShowOtherMonthsDays="false" OnDefaultViewChanged="RadCalendar1_DefaultViewChanged"
            <ClientEvents OnDateSelecting="DateSelected" /> 
            <HeaderTemplate> 
                <asp:Image ID="HeaderImage" runat="server" Width="757" Height="94" Style="display: block" /> 
            </HeaderTemplate> 
            <FooterTemplate> 
                <asp:Image ID="FooterImage" runat="server" Width="757" Height="70" Style="display: block" /> 
            </FooterTemplate> 
            <SpecialDays> 
            <telerik:RadCalendarDay Date="2010/06/16" Repeatable="DayInMonth" TemplateID="DateTemplate" /> 
            </SpecialDays> 
            <CalendarDayTemplates> 
                <telerik:DayTemplate  ID="DateTemplate" runat="server"
                    <Content> 
                        <div class="rcTemplate rcDayDate"
                            date 
                        </div> 
                    </Content> 
                </telerik:DayTemplate> 
                <telerik:DayTemplate ID="MondayTemplate" runat="server" > 
                    <Content> 
                        <div class="rcTemplate rcMondayDate"
                            date 
                        </div> 
                    </Content> 
                </telerik:DayTemplate> 


 protected  void Page_Load(object  sender, EventArgs e) 
 if (!IsPostBack) 
 { 
    RadCalendarDay NewDay = new RadCalendarDay(RadCalendar1); 
    NewDay.Date = new DateTime(2010, 6, 20); <--Fire
    NewDay.Repeatable = RecurringEvents.DayAndMonth;<--Fire
    NewDay.TemplateID = "MondayTemplate"; <---------------NOT FIRED
    NewDay.ToolTip = "Tip";    <---Fire or ItemStyle.CssClass = "MyClass"; is ok.
    RadCalendar1.SpecialDays.Add(NewDay); 
 } 
}  

The Result is like no template added
<td title="Tip">
<div class="radTemplateDay_Special">18</div>
</td>

SpecialDays are lost after paging to next or prev month if added or not as markup.

8 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 17 Jun 2010, 12:45 PM
Hello Pierre,

I suggest you to add the specialdays in DayRender event. Check for the condition in DayRender event and add required days in SpecialDays collection in DayRender event itself.

All the best,
Maria Ilieva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Prince
Top achievements
Rank 1
answered on 16 Jul 2010, 02:06 PM

Hi, I want to use the Calendar control in an asp.net mvc2 project, 

Can you please provide information on how to do this.

0
Sebastian
Telerik team
answered on 16 Jul 2010, 02:24 PM
Hello Prince,

You may consider using our Calendar MVC component for this purpose. Refer to the Telerik MVC online demos for more details.

Best regards,
Sebastian
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Prince
Top achievements
Rank 1
answered on 16 Jul 2010, 04:07 PM

we already have the MVC control, we have paid for the full package, your online demos do not show the control working as I would like.

I want to use the asp.net calendar's Calendar / Special Days and templates (http://demos.telerik.com/aspnet-ajax/calendar/examples/functionality/specialdays/defaultcs.aspx).

your demo doesn't show the MVC controls working in that manner. I have a sample page below.

What I want to do is to be able to assign events to days (multiple entries) which asp.net calendar control supports and the MVC control doesn't. 

The issue I am having is that when the special days are declared via asp.net markup, it works. however any special days added via code doesn't get rendered. So I want to know how to get the special days rendered programatically.

my mvc page is having the issue that is in this thread.

So can you please suggest a solution.

Thanks in advance

01.<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
02.<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
03.  
04.<html>
05.<head></head>
06.<body>
07.    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
08.    <%
09.        myCalender.UseColumnHeadersAsSelectors = false;
10.        myCalender.WeekendDayStyle.BackColor = System.Drawing.Color.Azure;
11.        myCalender.RangeMinDate = DateTime.Parse("1 Jan 2010");
12.        myCalender.DayNameFormat = DayNameFormat.Short;
13.        myCalender.Width = 600;
14.        myCalender.Height = 400;
15.          
16.        DateTime anchorDate = DateTime.Now;
17.  
18.        myCalender.CalendarDayTemplates.Add(new DayTemplate()
19.        {
20.            ID = "CountryHoliday"
21.        });
22.          
23.  
24.        RadCalendarDay NewDay = new RadCalendarDay(myCalender);
25.        NewDay.Date = new DateTime(2010, 07, 02);
26.        NewDay.Repeatable = Telerik.Web.UI.Calendar.RecurringEvents.DayAndMonth;
27.        NewDay.TemplateID = "TestTemplate";
28.        NewDay.ToolTip = "Anne's Birthday";
29.        myCalender.SpecialDays.Add(NewDay);
30.  
31.        myCalender.SpecialDays.Add(new RadCalendarDay(myCalender)
32.        {
33.            Date = anchorDate.AddDays(6),
34.            TemplateID = "TestTemplate"
35.  
36.        });
37.  
38.        myCalender.SpecialDays.Add(new RadCalendarDay(myCalender)
39.        {
40.            Date = anchorDate.AddDays(-4),
41.            TemplateID = "CountryHoliday"
42.  
43.        });
44.  
45.        myCalender.SpecialDays.Add(new RadCalendarDay(myCalender)
46.        {
47.            Date = anchorDate.AddDays(-1),
48.            TemplateID = "BirthdayTemplate"
49.  
50.        });        
51.                  
52.         %>
53.    
54.<telerik:RadCalendar ID="myCalender" runat="server" AutoPostBack="false">
55.    <CalendarDayTemplates>
56.            <telerik:DayTemplate ID="DateTemplate" runat="server">
57.                <Content>
58.                    <div class="rcTemplate rcDayDate">
59.                        date
60.                    </div>
61.                </Content>
62.            </telerik:DayTemplate>
63.            <telerik:DayTemplate ID="MortgageTemplate" runat="server">
64.                <Content>
65.                    <div class="rcTemplate rcDayMortgage">
66.                        mortgage
67.                    </div>
68.                </Content>
69.            </telerik:DayTemplate>
70.            <telerik:DayTemplate ID="TestTemplate" runat="server">
71.                <Content>
72.                    <div class="rcTemplate rcDayBirthday">
73.                    I am a test template
74.                    </div>
75.                </Content>
76.            </telerik:DayTemplate>
77.            <telerik:DayTemplate ID="BirthdayTemplate" runat="server">
78.                <Content>
79.                    <div class="rcTemplate rcDayBirthday">
80.                    18<br />
81.                        Joshua(7)<br />
82.                        Persia(2)
83.                    </div>
84.                </Content>
85.            </telerik:DayTemplate>
86.        </CalendarDayTemplates>
87.      <SpecialDays>
88.        <telerik:RadCalendarDay Date="2010/07/18"  TemplateID="BirthdayTemplate" />
89.      </SpecialDays>
90.  </telerik:RadCalendar>
91.    
92.      <p>
93.      Special day count: <%=myCalender.SpecialDays.Count%><br />
94.      Calendar template count: <%=myCalender.CalendarDayTemplates.Count%>
95.      </p>
96.</body>
97.</html>



0
Iana Tsolova
Telerik team
answered on 22 Jul 2010, 07:54 AM
Hello Prince,

Could you please try adding the SpecialDays on Page_Load but later and see if it works?
Let me know how it goes.

Best wishes,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kaveh
Top achievements
Rank 1
answered on 02 Jan 2015, 01:19 PM
can you pass us sample code to do dynamically adding of Special days in day rendering events
0
Kaveh
Top achievements
Rank 1
answered on 02 Jan 2015, 01:23 PM
can you pass me the sample demo to implement special days in day render event
0
Maria Ilieva
Telerik team
answered on 05 Jan 2015, 12:42 PM
Hi Kaveh,

Find attached a sample page that works properly on my end.

Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Calendar
Asked by
Pierre
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Prince
Top achievements
Rank 1
Sebastian
Telerik team
Iana Tsolova
Telerik team
Kaveh
Top achievements
Rank 1
Share this question
or