Displaying the calendar week while selecting the date from RadDatePicker

3 posts, 1 answers
  1. Kothai
    Kothai avatar
    9 posts
    Member since:
    Jul 2013

    Posted 12 Jul 2013 Link to this post

    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. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Jul 2013 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kothai
    Kothai avatar
    9 posts
    Member since:
    Jul 2013

    Posted 12 Jul 2013 Link to this post

    Hello Shinu,

    Thank u. It works.

Back to Top