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

Displaying the calendar week while selecting the date from RadDatePicker

2 Answers 58 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Kothai
Top achievements
Rank 1
Kothai asked on 12 Jul 2013, 07:38 AM
Hello,
I have a requirement in which, I need to show the calendar week for the date selected from Rad date picker. 
Is there any inbuilt property for rad date picker to show the calendar week? or how can I do this?

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 1
answered on 12 Jul 2013, 09:23 AM
Hi Kothai

Try the following markup and code snippet to get the calendar week number on date selected
aspx:
<telerik:RadDatePicker ID="RadDatePicker1" runat="server" OnSelectedDateChanged="RadDatePicker1_SelectedDateChanged" AutoPostBack="true">
</telerik:RadDatePicker>
C#:
protected void RadDatePicker1_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
{
    DateTime dt = (DateTime)RadDatePicker1.SelectedDate;
    CultureInfo c = RadDatePicker1.Calendar.CultureInfo;
    int weeknumber = c.Calendar.GetWeekOfYear(dt, c.DateTimeFormat.CalendarWeekRule,c.DateTimeFormat.FirstDayOfWeek);
     
}

Thanks
Shinu
0
Kothai
Top achievements
Rank 1
answered on 12 Jul 2013, 11:06 AM
Hello Shinu,

Thank u. It works.

Tags
Calendar
Asked by
Kothai
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Kothai
Top achievements
Rank 1
Share this question
or