FormatException 未被用户代码处理。
该字符串未被识别为有效的日期时间。
protected void Page_Load(object sender, EventArgs e)
{
// to simulate a database query
socialEvents = new DataTable();
socialEvents.Columns.Add(new DataColumn("Date", typeof(DateTime)));
socialEvents.Columns.Add(new DataColumn("Description", typeof(string)));
socialEvents.Columns.Add(new DataColumn("Url", typeof(string)));
DataRow row;
row = socialEvents.NewRow();
row["Date"] = DateTime.Now.AddDays(-5);
row["Description"] = "Work";
row["Url"] = "http://www.url.cz";
socialEvents.Rows.Add(row);
}
以下方法中的错误:
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
**DataRow[] rows = socialEvents.Select(
String.Format(
"Date >= #{0}# AND Date < #{1}#",
e.Day.Date.ToShortDateString(),
e.Day.Date.AddDays(1).ToShortDateString()**
)
);