How do I get the new date selected by the user? With the following code when I click on a date I keep on getting the date I assigned in pageload. The value never changes. What am I missing?? I just want to get the date the user selects on the calendar control.
Why does e.SelectedDates has always one date in it and that date is the one I assign in pageload.?? I just the need the date, it should be straight forward.
<telerik:RadCalendar ID="telerikCalendar" runat="server" Font-Names="Arial,Verdana,Tahoma"
ForeColor="Black" Style="border-color: #ececec"
OnSelectionChanged="SelectedDateChange" EnableMultiSelect="false"
AutoPostBack="true">
</telerik:RadCalendar>
In PageLoad:
if( !IsPostBack )
{
telerikCalendar.SelectedDate = DateTime.Now;
}
protected void SelectedDateChange(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e)
{
DateTime t = (DateTime) telerikCalendar.SelectedDate;
if ( e.SelectedDates.Count > 0)
{
strDateSelected = e.SelectedDates[0].Date.ToString();
}
}
It has been 7 hours since I posted my question and I have got no response yet. That is very disappointing.
Why does e.SelectedDates has always one date in it and that date is the one I assign in pageload.?? I just the need the date, it should be straight forward.
<telerik:RadCalendar ID="telerikCalendar" runat="server" Font-Names="Arial,Verdana,Tahoma"
ForeColor="Black" Style="border-color: #ececec"
OnSelectionChanged="SelectedDateChange" EnableMultiSelect="false"
AutoPostBack="true">
</telerik:RadCalendar>
In PageLoad:
if( !IsPostBack )
{
telerikCalendar.SelectedDate = DateTime.Now;
}
protected void SelectedDateChange(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e)
{
DateTime t = (DateTime) telerikCalendar.SelectedDate;
if ( e.SelectedDates.Count > 0)
{
strDateSelected = e.SelectedDates[0].Date.ToString();
}
}
It has been 7 hours since I posted my question and I have got no response yet. That is very disappointing.