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

Problem on selecting special days in RadCalendar

1 Answer 136 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Hemamalini
Top achievements
Rank 1
Hemamalini asked on 13 Aug 2011, 10:42 AM
Hi,

    I use RadCalendar in my project. My problem is the special days are not selectable in RadCalendar. I have used AutoPostBack="true" and OnSelectionChanged property. I need to redirect the selected date to other page., but the click event is not fired on selecting the special day. I also use RadScheduler also in the same page. On using div i used to hide one by other. Below is the design page of it,

<asp:UpdatePanel ID="updatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <div>
                <div id="divSchedular" runat="server">
                    <div style="width: 810px; background: transparent url('Images/background.png') no-repeat 0 0;
                        padding-left: 20px;">
                        <telerik:RadScheduler runat="server" ID="RadScheduler1" Skin="Web20" CustomAttributeNames="DisplayStartTime, EventColor, DisplayEndTime, StartDate,EndDate,DisplayPermitName,DisplayFacilityVisibility,DisplayClientVisibility,DisplayResourceVisibility,Id,DisplayPermitVisibility,DisplayFacilityname,DisplayResourceName,DisplayClientName"
                            DataStartField="StartDate" EnableDatePicker="true" GroupingDirection="Horizontal"
                            EnableEmbeddedSkins="true" DataDescriptionField="EventColor" MonthView-GroupingDirection="Horizontal"
                            DataEndField="EndDate" ShowFullTime="true" DataKeyField="Id" FirstDayOfWeek="Sunday"
                            LastDayOfWeek="Saturday" DataSubjectField="DisplayPermitName" AllowDelete="false"
                            AllowEdit="false" TimelineView-NumberOfSlots="7" AllowInsert="false" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound">
                            <AdvancedForm Modal="true" />
                            <%--daystarttime="08:00:00" dayendtime="23:00:00"--%>
                            <AppointmentTemplate>
                                <div>
                                    <table>
                                        <tr>
                                            <td id="divColorChange" runat="server" width="0.5%">
                                                <div>
                                                     <%--CommandArgument='<%# Eval("Id") + "~" + Eval("EventColor") %>'--%>
                                                </div>
                                            </td>
                                            <td>
                                                <%--CustomAttributeNames="StartTime,EndTime,SessionDate,DisplayPermitName,StartDate,DisplayClientVisibility,DisplayResourceVisibility,DisplayFacilityVisibility,EndDate,ID,DisplayPermitVisibility,DisplayFacilityName,DisplayResourceName,DisplayClientName,Event_ID,DisplayRoomNumber"--%>
                                                <div class="AlignCenter">
                                                    <%--Permit Name--%>
                                                    <asp:LinkButton runat="server" ID="lblDisplayPermitName" OnClick="RedirectToEventMaintenance"
                                                        Style="font-weight: bold; color: Black; word-wrap: break-word; font-size: 12px;"
                                                        Visible='<%# Convert.ToBoolean(Eval("DisplayPermitVisibility")) %>' CommandArgument='<%# Eval("Id") + "~" + Eval("StartDate")%>'> 
                        <%# Eval("DisplayPermitName")%>
                                                    </asp:LinkButton>
                                                    <asp:Label ID="labelPermitName" Style="font-weight: normal; color: Black; word-wrap: break-word;
                                                        font-size: 10px;" runat="server" Text='<%# Eval("DisplayPermitName")%>' CssClass="FontBold"></asp:Label>
                                                    <br />
                                                    <%--Start Time--%>
                                                    <%--End Time--%>
                                                    <asp:Label runat="server" ID="lblStartTime" Style="font-weight: normal; word-wrap: break-word;
                                                        color: Black; font-size: 10px; text-align: left; float: left;">
                                                    <%# Eval("DisplayStartTime")%></asp:Label>
                                                    -
                                                    <asp:Label runat="server" ID="lblEndTime" Style="font-weight: normal; word-wrap: break-word;
                                                        color: Black; font-size: 10px; text-align: left; float: left;">
                                                    <%# Eval("DisplayEndTime")%></asp:Label>
                                                    <br />
                                                    <%--Client Name--%>
                                                    <asp:Label runat="server" ID="lblDisplayClientTypeName" Style="font-weight: normal;
                                                        word-wrap: break-word; color: Black; font-size: 10px; width: 95px; text-align: left;
                                                        float: left;" Visible='<%# Convert.ToBoolean(Eval("DisplayClientVisibility")) %>'>
                            <%# Eval("DisplayClientName")%>
                                                    </asp:Label><br />
                                                    <%--Text="<left>Client :</left>"--%>
                                                    <%--Facility Name--%>
                                                    <asp:Label runat="server" ID="lblDisplayFacilityName" Style="font-weight: normal;
                                                        color: Black; font-size: 10px; word-wrap: break-word; width: 95px; float: left;
                                                        float: left; text-align: left; float: left;" Visible='<%# Convert.ToBoolean(Eval("DisplayFacilityVisibility")) %>'>
                            <%# Eval("DisplayFacilityname")%>
                                                    </asp:Label><%--Text="<left>Facility :</left>"--%>
                                                    <br />
                                                    <%--Resource Name--%>
                                                    <asp:Label runat="server" ID="lblDisplayResourceName" Style="font-weight: normal;
                                                        color: Black; font-size: 10px; word-wrap: break-word; width: 95px; text-align: left;
                                                        float: left;" Visible='<%# Convert.ToBoolean(Eval("DisplayResourceVisibility")) %>'>
                            <%# Eval("DisplayResourceName")%> 
                                                    </asp:Label><br />
                                                    <%--Text="<left>Resource :</left>" --%>
                                                    <%--Resource Name--%>
                                                    <asp:Label runat="server" ID="Label2" Style="font-weight: normal; width: 95px; color: Black;
                                                        font-size: 10px; text-align: left; word-wrap: break-word; float: left;"><%-- Text="<left>Room :</left>"--%>
                            <%# Eval("DisplayResourceName")%> 
                                                    </asp:Label><br />
                                                    <br />
                                                    <asp:LinkButton ID="linkButtonMore" Style="font-weight: bold; width: 95px; color: Black;
                                                        font-size: 10px;" runat="server" Text="More"></asp:LinkButton>
                                                </div>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </AppointmentTemplate>
                        </telerik:RadScheduler>
                    </div>
                    <telerik:RadToolTipManager runat="server" ID="RadToolTipManager1" Width="420" Height="300"
                        ToolTipZoneID="RadScheduler1" Animation="Resize" HideEvent="LeaveToolTip" Text="Loading..."
                        RelativeTo="Mouse" OnAjaxUpdate="RadToolTipManager1_AjaxUpdate" OnClientBeforeShow="clientBeforeShow">
                    </telerik:RadToolTipManager>
                </div>
                <div class="ClearBoth">
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <div id="divCalendar" runat="server" visible="false">
        <telerik:RadCalendar ID="RadCalendar1" runat="server" Font-Names="Arial,Verdana,Tahoma"
            OnSelectionChanged="RadCalendar1_SelectionChanged" AutoPostBack="true" ForeColor="Black"
            Skin="Web20" MultiViewColumns="4" MultiViewRows="3" PresentationType="Preview"
            UseColumnHeadersAsSelectors="false" UseRowHeadersAsSelectors="false" ShowOtherMonthsDays="False">
        </telerik:RadCalendar>
    </div>

The special days are populated in codebehing using,

RadCalendar1.SelectedDates.Clear();
RadCalendar1.SpecialDays.Clear();
RadCalendarDay NewDay = new RadCalendarDay(RadCalendar1);
this.EventController.State.Events = EventCollection;
if (this.EventController.State.Events.Count > 0)
{
    foreach (Event eventObj in this.EventController.State.Events)
    {
        NewDay.Date = DateTime.Parse(eventObj.StartDate.ToString());
        NewDay.IsSelectable = true;
        NewDay.ItemStyle.CssClass = "specialDay";
        NewDay.ToolTip = eventObj.Permit.PermitName;
           NewDay.ItemStyle.BackColor = System.Drawing.Color.Aqua;
        NewDay.ItemStyle.BorderColor = System.Drawing.Color.Blue;
        RadCalendar1.SelectedDates.Add(new RadDate(Convert.ToDateTime(eventObj.StartDate.ToString())));
        RadCalendar1.SpecialDays.Add(NewDay);
    }
}

I also need to set the bordercolor and backcolor for the special day. i have used ItemStyle property as shown above. but the specified color is not applied to the calendar. It takes the default skin color (Web20)  for the special day. Kindly help me out to get rid of this problem.

Thanks,
Hema L.

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 18 Aug 2011, 01:18 PM
Hi Hemamalini,

I tried to replicate the described issue locally but to no avail.

Please find attached a small runnable example which works correctly on my side. Test it locally and let me know what the difference in your case is.

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.

Tags
Calendar
Asked by
Hemamalini
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or