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

[Solved] RadCalendar with EnableMultiSelect loses specialdays data upon navigation

1 Answer 113 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Sivakumar Chandran
Top achievements
Rank 1
Sivakumar Chandran asked on 23 Dec 2009, 03:08 PM

This is the definition we have in .aspx

 

 

<telerik:RadCalendar ID="RadCalendar2" runat="server" Font-Names="Arial,Verdana,Tahoma"

 

 

 

ForeColor="Black" Skin="Outlook" Style="border-color: #ececec"

 

 

 

EnableViewSelector="True" AutoPostBack="false">

 

 

 

</telerik:RadCalendar>

 

 

 

A function with the following lines is called on pageload:

 

RadCalendar2.SpecialDays.Clear();

RadCalendar2.SelectedDates.Clear();

 

 

RadCalendarDay NewDay = new RadCalendarDay(RadCalendar2);

 

 

 

foreach (DataRow drrow in dtALLDates.Rows)

 

{

NewDay =

new RadCalendarDay(RadCalendar2);

 

NewDay.Date =

Convert.ToDateTime(drrow["CalendarDate"]);

 

NewDay.ToolTip =

Convert.ToInt32(drrow["SeatsAvailable"]) > 0 ? Convert.ToInt32(drrow["SeatsAvailable"]) > 1 ? drrow["SeatsAvailable"] + " seats are available" : "1 seat is available"

 

 

 

 

:

Convert.ToInt32(drrow["InSchedule"]) == 0 ? "Session not offered or it is a holiday." : "Seats are not available.";

 

 

Boolean bselect = Convert.ToInt32(drrow["SeatsAvailable"]) > 0 && Convert.ToBoolean(drrow["AllowEdit"]) == true ? true : false;

 

NewDay.IsSelectable = bselect;

 

if (Convert.ToBoolean(drrow["IsOpted"]) == true)

 

{

NewDay.IsSelected =

true;

 

RadCalendar2.SelectedDates.Add(

new RadDate(Convert.ToDateTime(drrow["CalendarDate"].ToString())));

 

}

RadCalendar2.SpecialDays.Add(NewDay);

}


When we navigate from one month to another month, the highlighted dates are cleared. I tried lot of things. But nothing working. Please help me to come out of this issue.

Thanks a lot in advance.

Siva

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 29 Dec 2009, 01:29 PM
Hi Siva,

I looked through your code and I think that the problem is caused by the following code line:

NewDay.IsSelectable = bselect;

This code made the date in NewDay not selectable, however the next few rows of code select some of the dates:

if (Convert.ToBoolean(drrow["IsOpted"]) == true)
{
    NewDay.IsSelected = true;
    RadCalendar2.SelectedDates.Add(new
         RadDate(Convert.ToDateTime(drrow["CalendarDate"].ToString())));
}

In some cases this code selects dates which are set to be not selectable.
Additionally I am attaching a simple example based on your code.
I hope this helps.

All the best,
Radoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Calendar
Asked by
Sivakumar Chandran
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or