如何根据用户选择的 DropDownList 中的名称设置无法选择的日历日期?换句话说,DropDownList 中的每个名称都将设置不同的不可选择的日期,我尝试使用以下代码来执行我的程序,但它似乎无法正常工作。我该怎么做?
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;
}
}
}