How do i set the calendar dates unselectable accordingly to the name in the DropDownList the users select? In other words, each name in the DropDownList will have different unselectable dates set and i tried to use the following codes to execute my program but it seems to be not working. How do i do so?
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList1.SelectedItem.Text == "WeddingPlanner1")
{
if (e.Day.Date.Month == 7 || e.Day.Date.Month == 9 || e.Day.Date.Month == 12)
{
if (e.Day.Date.Day == 5 || e.Day.Date.Day == 14 || e.Day.Date.Day == 18)
{
e.Day.IsSelectable = false;
e.Cell.ForeColor = System.Drawing.Color.Black;
e.Cell.BackColor = System.Drawing.Color.White;
e.Cell.Font.Bold = true;
}
}
}
You can make a day readonly of a asp.net calendar control using the same code what you have, but in the _DayRender event