if (e.Row.RowType == DataControlRowType.DataRow)
{
DateTime bookingdate = DataBinder.Eval(e.Row.DataItem, "bookingdate");
if (bookingdate < DateTime.Now.Day())
e.Row.BackColor = Color.Yellow;
}Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0266: Cannot implicitly convert type 'object' to 'System.DateTime'. An explicit conversion exists (are you missing a cast?)Source Error: Line 20: if (e.Row.RowType == DataControlRowType.DataRow)
Line 21: {
Line 22: [color=#FF0000]DateTime bookingdate = DataBinder.Eval(e.Row.DataItem, "bookingdate");Line 23: if (bookingdate < DateTime.Now.Day())
Line 24: e.Row.BackColor = Color.Yellow;
[/color]
{
DateTime bookingdate = DataBinder.Eval(e.Row.DataItem, "bookingdate");
if (bookingdate < DateTime.Now.Day())
e.Row.BackColor = Color.Yellow;
}Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0266: Cannot implicitly convert type 'object' to 'System.DateTime'. An explicit conversion exists (are you missing a cast?)Source Error: Line 20: if (e.Row.RowType == DataControlRowType.DataRow)
Line 21: {
Line 22: [color=#FF0000]DateTime bookingdate = DataBinder.Eval(e.Row.DataItem, "bookingdate");Line 23: if (bookingdate < DateTime.Now.Day())
Line 24: e.Row.BackColor = Color.Yellow;
[/color]
DateTime bookingdate = DateTime.Parse(DataBinder.Eval(e.Row.DataItem, "bookingdate"));
我晕啊~~~DateTime.Now.Day()) 就是当前日期,,因为怎么表示呢谢谢你了
if (e.Row.RowType == DataControlRowType.DataRow)
{
System.Data.DataRowView drv = (System.Data.DataRowView)e.Row.DataItem; DateTime bookingdate = Convert.ToDateTime(drv["bookingdate"]); // DataBinder.Eval(e.Row.DataItem, "bookingdate");
if (bookingdate < DateTime.Now.Date) // DateTime.Now.Day())
e.Row.BackColor = Color.Yellow;
}
谢谢各位热心的对我这个超级笨的菜鸟帮助了~~
真的谢谢各位了!!!