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

Selected day not retained after SelectedDateChange

1 Answer 33 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Ben White
Top achievements
Rank 1
Ben White asked on 28 Oct 2010, 03:46 PM
Hi,

I am setting selected dates from a database during the DayRender event.

When I then fire the SelectedDateChange, the selected dates I have added are no there. It will only give me the new dates that have been subsequently selected.

My Code in the DayRender event is:

foreach (DateTime dt in Session["DBBookedDays"] as ArrayList)
        {
            if ((e.Day.Date >= Convert.ToDateTime(jStartDate.Text) && e.Day.Date <= Convert.ToDateTime(jEndDate.Text)) && e.Day.Date.ToShortDateString() == dt.ToShortDateString())
            {
                e.Cell.CssClass = "rcSelected";
                e.Cell.ToolTip = "Already booked in for this job";
                renderedDay.IsSelected = true;
                break;
            }
        }


If I then loop through selected dates on the SelectedDateChange event then this selected date no longer exists.

Thanks in advance

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 02 Nov 2010, 03:52 PM
Hi Ben,

I suggest that you add the dates you want to be marked as selected in Page_Load instead. There get the dates from database and add them to the SelectedDates collecion.

Regards,
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
Tags
Calendar
Asked by
Ben White
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or