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

RadCalendar.FocusedDate not showing in the view area

5 Answers 170 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
anu
Top achievements
Rank 1
anu asked on 10 Jan 2011, 04:45 PM

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.

5 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 10 Jan 2011, 04:50 PM
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
0
anu
Top achievements
Rank 1
answered on 10 Jan 2011, 04:56 PM
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
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 10 Jan 2011, 05:06 PM
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

0
anu
Top achievements
Rank 1
answered on 10 Jan 2011, 07:49 PM

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;

 

0
Richard Slade
Top achievements
Rank 2
answered on 10 Jan 2011, 08:09 PM
Glad that helped and you have it sorted.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
anu
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
anu
Top achievements
Rank 1
Share this question
or