Web Forms Question:
Download Questions PDF

How to select multiple non-sequential dates at Code-Behind in Microsoft web forms?

Answer:

Invoke the member function ‘Add’ of the control's SelectedDates collection. You can add dates in any sequence, because the collection will automatically arrange them in order for you.

protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
Calendar1.SelectedDates.Clear();
Calendar1.SelectedDates.Add(new DateTime(2008, 8, 1));
Calendar1.SelectedDates.Add(new DateTime(2008, 8, 7));
Calendar1.SelectedDates.Add(new DateTime(2008, 8, 15));
}

Download Microsoft Web Forms Interview Questions And Answers PDF

Previous QuestionNext Question
How to upload an image files only in .net web forms?How to disable some dates in Calendar control in web forms?