locked
Problem in setting calendar selected date RRS feed

  • Question

  • I am using the fallowing code to set the selected date of calendar control to one day previous of the current date, but still the calendar is showing the current date as the selected date.

    Calendar1.SelectedDate =

    DateTime.Now.AddDays(-1);

    can anyone help me regarding this issue.

    Monday, November 1, 2010 12:04 PM

Answers

  • Hi Manjunath,

    use following code it will solve your problem.

    Calendar1.TodaysDate = DateTime.Now.AddDays(-1)

    Instead of using SelectedDate use TodaysDate

     

    Cheers..........  :)

    Regards

    AtishRG

     

     


    AtishRG
    • Marked as answer by SamAgain Friday, November 12, 2010 8:44 AM
    Tuesday, November 2, 2010 8:58 AM

All replies

  • In which event handler, are you putting this code?
    Ali Hamdar (alihamdar.com - www.ids.com.lb)
    Monday, November 1, 2010 12:58 PM
  • I am using this codein form load event
    Tuesday, November 2, 2010 6:58 AM
  • Hi Manjunath,

    use following code it will solve your problem.

    Calendar1.TodaysDate = DateTime.Now.AddDays(-1)

    Instead of using SelectedDate use TodaysDate

     

    Cheers..........  :)

    Regards

    AtishRG

     

     


    AtishRG
    • Marked as answer by SamAgain Friday, November 12, 2010 8:44 AM
    Tuesday, November 2, 2010 8:58 AM