-1
I am doing a final project, where a record of task, description and date is made. But I am unable to put a warning/alert/message on the screen to warn the user that a task is expiring. I am programming for web in ASP.NET, C# and the Database is SQL Server Express. I tried with this code, but nothing happens.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DateTime dt = DateTime.ParseExact(e.Row.Cells[3].Text, "0:dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
if (dt < DateTime.Now)
e.Row.Style.Add("background-color", "red");
}
}
I would like to leave it that way when a system date coincides with the same computer, not necessarily identical but with some outline, or a background color in the line of the Gridviewer for highlight.
Please post the code in text. It is difficult to test with just one photo as an example
– Arthur Siqueira
I put the code in text.
– Israel Costa e Silva
iDate needs to be a string with a date. If you want to use computer time you can use Datetime.Now or Datetime.Utcnow.
– tvdias