I'm close to being able to do what I'd like to do. However, I am having a problem with the radcalendar, and I have always found this control extremely frustrating to use because I cannot
simply get the date that was clicked.
I'm looping through all the events on page load, and for each event I'm adding a selected date to the rad calendar. But it seems there is no way to simply get the date that was clicked on when autopostback is set to true. Selected date is not correct. It just gets the last date that was added to the SelectedDates collection. SelectedDates[SelectedDates.Count - 1] is not correct either because if June 5th is the last one added, and I click May 8th, June 5th is returned.
Here's my code. It's from a user control that has a radcalendar and nothing else.
private Guid _pageId = Guid.Empty;
private string _navigateUrl = string.Empty;
/// <summary>Gets or sets ID to a SitefinityPage</summary>
/// <value>Sitefinity Page ID.</value>
[TypeConverter("Telerik.Cms.Web.UI.GuidTypeConverter, Telerik.Cms"),
Category("Navigation"),
WebEditor("Telerik.Cms.Web.UI.DhlIdEditor, Telerik.Cms"),
DisplayName("Events Page"),
DefaultValue(typeof(Guid), "00000000-0000-0000-0000-000000000000")]
public Guid PageId
{
get
{
return this._pageId;
}
set
{
this._pageId = value;
}
}
[UrlProperty, WebEditor("Telerik.Cms.Web.UI.DhlUrlEditor, Telerik.Cms"), Bindable(true), Category("Navigation"), DefaultValue("")]
public string NavigateUrl
{
get
{
return this._navigateUrl;
}
set
{
this._navigateUrl = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
Telerik.Events.EventsManager mgr = new Telerik.Events.EventsManager("Events");
if (!Page.IsPostBack)
{
foreach (IEvent evt in mgr.GetEvents())
calendar.SelectedDates.Add(new RadDate(evt.Start));
}
}
protected void calendar_SelectionChanged(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e)
{
//Response.Redirect(this._navigateUrl + "?eventsdate=" + Server.UrlEncode(e.? << What goes here);
}
So my question is this now...if you add selected dates to a radcalendar, and a user clicks any date on the calendar, how do you get date that was clicked on a server-side postback?