I tried to use the UserControl in the DayTemplate. This user control has 2 buttons inside, it subscribes to these buttons click events. The question is, how the user control knows what is the date that user selecting from the event listener ()?
With below implementation, I noticed that click event in the user control is fired before the RadCalendar1 SelectedDate is modified accordingly. Please advise.
Second Question: Is it possible to do data binding in the DayTemplate? something like below code (this code is not working though):
With below implementation, I noticed that click event in the user control is fired before the RadCalendar1 SelectedDate is modified accordingly. Please advise.
<telerik:RadCalendar ID="RadCalendar1" runat="server" AutoPostBack="true" Skin="Special" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false" EnableMonthYearFastNavigation="false" DayNameFormat="Short" ShowRowHeaders="false" OnDayRender="Calendar_OnDayRender" OnPreRender="RadCalendar1_PreRender" OnSelectionChanged="RadCalendar1_SelectionChanged" ShowOtherMonthsDays="false" OnDefaultViewChanged="RadCalendar1_DefaultViewChanged" EnableMultiSelect="false"> <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="2012/01/22" Repeatable="DayAndMonth" TemplateID="BlockedTemplate" /> <telerik:RadCalendarDay Date="2012/01/27" Repeatable="DayInMonth" TemplateID="GeneralTemplate" /> </SpecialDays> <ClientEvents OnDayRender="OnDayRender" OnDateSelected="OnDateSelected" /> <CalendarDayTemplates> <telerik:DayTemplate ID="BlockedTemplate" runat="server"> <Content> <div class="rcTemplate rcDayBirthday"> Blocked! </div> </Content> </telerik:DayTemplate> <telerik:DayTemplate ID="GeneralTemplate" runat="server"> <Content> <div class="rcTemplate rcDayMortgage"> Available! <br /> <control:GeneralDayTemplate runat="server" ID="templateAMPM"/> </div> </Content> </telerik:DayTemplate> </CalendarDayTemplates> </telerik:RadCalendar> <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="GeneralDayTemplate.ascx.cs" Inherits="RadWebApp.Controls.GeneralDayTemplate" %> <asp:Button runat="server" ID="btnA" Text="A" OnClick="btnA_Click"/> <asp:Button runat="server" ID="btnB" Text="B" OnClick="btnB_Click"/> public partial class GeneralDayTemplate : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } protected void btnA_Click(object sender, EventArgs e) { /*I need to know which date i'm selecting here????*/ } protected void btnB_Click(object sender, EventArgs e) { } } Second Question: Is it possible to do data binding in the DayTemplate? something like below code (this code is not working though):
<telerik:DayTemplate ID="GeneralTemplate" runat="server"> <Content> <div class="rcTemplate rcDayMortgage"> Available! <br /> <control:GeneralDayTemplate runat="server" ID="templateAMPM" Date='<%# Bind("Date")%>'/> </div> </Content> </telerik:DayTemplate>