RadCalendar.FocusedDate not showing in the view area

6 posts, 1 answers
  1. anu
    anu avatar
    14 posts
    Member since:
    Nov 2010

    Posted 10 Jan 2011 Link to this post


    I have a RadCalendar set to a focused date, say 1/15/11 , but after i use the navigate button to move it to Feb and then bring it up again, it shows the month of Feb in the view instead of Jan (where focused date is 1/15/11). Do i have to do anything else to show the focused date on the calendars view.

     

     

    cal_Dates.SelectedDate = (

     

    DateTime)gv.Rows[e.RowIndex].Cells["SyDate"].Value; //eg- 1/15/11

     

    cal_Dates.FocusedDate = cal_Dates.SelectedDate;

    Thanks in advance for any help.

  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 10 Jan 2011 Link to this post

    Hello anu,

    Please could you explain what you mean by 'bring it up again'? is the radCalendar in a different form?
    If you could explain, I'll try this out for you and do my best to help
    thanks
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. anu
    anu avatar
    14 posts
    Member since:
    Nov 2010

    Posted 10 Jan 2011 Link to this post

    I have a grid control with dates column and when clicked on the grid cell, it shows a panel which contains a RadCalendar. As the user click on date cell it makes the panel visible/hide and applies the dates based on the date on the cell. So basically we are showing the same calendar with a different focused date based on what is on the grid cell. If the user navigated to another month , say Feb, and when they click on cell with 1/15, the user still sees the Feb month on the calender , whereas the preferred is Jan, because focused date is set to 1/15.

    hope this explains
    Thanks
  5. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 10 Jan 2011 Link to this post

    Hello,

    From what you have said, you should only need to set the FocusedDate. Please can you try the following in a new project.
    • Add a RadPanel
    • Inside the RadPanel, add a RadCalendar
    • Add two RadButtons under the RadPanel. One called ButtonShow and another called ButtonHide
    • In form load, add the following code
    Me.RadCalendar1.FocusedDate = Now
    Me.RadCalendar1.SelectedDate = Now

    • Add the following click event handler for the buttons
    Private Sub ButtonHide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonHide.Click
        Me.RadPanel1.Visible = False
    End Sub
    Private Sub ButtonShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonShow.Click
        Me.RadPanel1.Visible = True
        Me.RadCalendar1.FocusedDate = Now
    End Sub

    • Now perform the following:
    • Use the navigation buttons, to move the month to February
    • Press the Hide button
    • Press the Show button
    • The calendar should show January as the seclected month with today highlighted.

    Hope that helps, but let me know if you need more information
    Richard

  6. anu
    anu avatar
    14 posts
    Member since:
    Nov 2010

    Posted 10 Jan 2011 Link to this post

    Thanks Richard for your response.
    In a new project it worked as you explained , however, it was not working for my project.
    Now i did a workaround and it is working. I first set the date to now before setting the actual focused date.

     

    cal_Dates.FocusedDate =

     

    DateTime.Now;

    ...

     

    cal_Dates.FocusedDate = actualdate;

     

  7. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 10 Jan 2011 Link to this post

    Glad that helped and you have it sorted.
Back to Top
UI for WinForms is Visual Studio 2017 Ready