How to make the month display for an old date?

3 posts, 0 answers
  1. DaveBarkshire
    DaveBarkshire avatar
    9 posts
    Member since:
    May 2012

    Posted 05 Jul 2012 Link to this post

    I have got a calendar working but when I set the date to an old date (server side) the calendar displays the current month.

    I am showing three months in a row. The date assignment during the page onload is working properly.

        tclCalendar.SelectedDate = dteDate;

        tclCalendar.DataBind();


    Ideally the middle month should be the month of the date which I have set.
    Is there somthing else which needs setting?

    Also, how do I remove the week number column?

     

    <telerik:RadCalendar ID="tclCalendar" runat="server" DayNameFormat="Short"

     

     

    Skin="Web20" EnableMultiSelect="False" UseRowHeadersAsSelectors="True" UseColumnHeadersAsSelectors="True"

     

     

    MultiViewColumns="3" AutoPostBack="True" EnableNavigationAnimation="True"

     

     

    CultureInfo="English (United Kingdom)" ShowOtherMonthsDays="False" TitleStyle-ForeColor="White"

     

     

    TitleStyle-CssClass="smallButton" WeekendDayStyle-BackColor="#F7F7F0" DayOverStyle-BorderColor="Black"

     

     

    EnableViewSelector="True">

     

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 Jul 2012 Link to this post

    Hi DaveBarkshire,

    Here is the code that I tried for showing three months in a row and to set the selected month as the middle month. Please try setting ShowRowHeaders property of RadCalendar to false to remove the week number column.

    ASPX:
    <telerik:RadCalendar ID="tclCalendar" runat="server" DayNameFormat="Short" Skin="Web20" ShowRowHeaders="false" EnableMultiSelect="False" UseRowHeadersAsSelectors="True" UseColumnHeadersAsSelectors="True"  MultiViewColumns="3" AutoPostBack="True" EnableNavigationAnimation="True" CultureInfo="English (United Kingdom)" ShowOtherMonthsDays="False" TitleStyle-ForeColor="White" TitleStyle-CssClass="smallButton" WeekendDayStyle-BackColor="#F7F7F0" DayOverStyle-BorderColor="Black" EnableViewSelector="True">
    </telerik:RadCalendar>

    C#:
    protected void Page_Load(object sender, EventArgs e)
       {
            DateTime dteDate = new DateTime(2010, 1, 18);
            tclCalendar.SelectedDate = dteDate;
            if (tclCalendar.SelectedDate.Month != 1)
            {
                int m = tclCalendar.SelectedDate.Month - 1;
                tclCalendar.FocusedDate = new DateTime(tclCalendar.SelectedDate.Year, m, tclCalendar.SelectedDate.Day);
            }
            else
            {
                int m = 12;
                int y = tclCalendar.SelectedDate.Year - 1;
                tclCalendar.FocusedDate = new DateTime(y, m, tclCalendar.SelectedDate.Day);
            }
            tclCalendar.DataBind();
      }

    Hope this helps.

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. DaveBarkshire
    DaveBarkshire avatar
    9 posts
    Member since:
    May 2012

    Posted 06 Jul 2012 Link to this post

    Many thanks Princy. That was very useful.
Back to Top