我正在尝试创建一个选择DateFrom和DateTo
DateFrom我需要从to遍历DateTo并在日历中显示所有这些日期,到目前为止我的代码只选择DateFromandDateTo并将它们作为标签显示在日历中:
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
    foreach (DataRow dr in ds.Tables[0].Rows)
    {
        DateTime df = (DateTime)dr.Field<DateTime?>("DateFrom");
        DateTime dt = (DateTime)dr.Field<DateTime?>("DateTo");
        if (e.Day.Date == dt.Date)
        {
            Label lbl = new Label();
            lbl.BackColor = System.Drawing.Color.Gray;
            lbl.Text = "Booked From";
            e.Cell.Controls.Add(lbl);
         }
        if (e.Day.Date == df.Date)
        {
            Label lbl = new Label();
            lbl.BackColor = System.Drawing.Color.Gray;
            lbl.Text = "Booked To";
            e.Cell.Controls.Add(lbl);
        }
    }