set
AutoPostBack
true for
DropDownList1
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" >
after that, move your code in to Day render event of your calendar control
protected void Calendar1_DayRender(object sender, DayRenderEventArgs 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 know how to add above event?
go to properties of your calendar control and then go to events tab and find the DayRender and double click on it.