Selected day not retained after SelectedDateChange

2 posts, 0 answers
  1. Ben White
    Ben White avatar
    23 posts
    Member since:
    Feb 2010

    Posted 28 Oct 2010 Link to this post

    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
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 02 Nov 2010 Link to this post

    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
Back to Top