LinkButton lnk2 = (LinkButton)e.Row.FindControl("lnkSelect"); if (e.Row.RowType == DataControlRowType.DataRow) { string dtimeString = Convert.ToDateTime(e.Row.Cells[2].Text).ToString("yy/MM/dd"); DateTime dtime = Convert.ToDateTime(dtimeString); DateTime nowtime = Convert.ToDateTime(DateTime.Now.ToString("yy/MM/dd")); if (dtime == nowtime) { lnk2.Enabled = true; //change the column backcolor // e.Row.Cells[0].BackColor = System.Drawing.Color.Yellow; //change the row backcolor // e.Row.BackColor = System.Drawing.Color.Yellow; } if (dtime > nowtime) { lnk2.Enabled = false; e.Row.Cells[0].BackColor = System.Drawing.Color.Red; // e.Row.BackColor = System.Drawing.Color.Red; } }
1. string dtimeString = Convert.ToDateTime(e.Row.Cells[2].Text).ToString("yy/MM/dd");2. DateTime dtime = Convert.ToDateTime(dtimeString);3. DateTime nowtime = Convert.ToDateTime(DateTime.Now.ToString("yy/MM/dd"));
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)