Hi relaxingmusic...,
Please refer below sample.
Model
public class Events
{
public int Id { get; set; }
public DateTime Date_Time_Fixed { get; set; }
public string Time_In_Fixed { get; set; }
public string PC_Name { get; set; }
public string Acc_Name { get; set; }
}
Controller
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
List<Events> events = new List<Events>();
events.Add(new Events { Id = 1, Date_Time_Fixed = new DateTime(2022, 10, 01), Time_In_Fixed = "Absent", PC_Name = "", Acc_Name = "" });
events.Add(new Events { Id = 2, Date_Time_Fixed = new DateTime(2022, 10, 02), Time_In_Fixed = "Absent", PC_Name = "", Acc_Name = "" });
events.Add(new Events { Id = 3, Date_Time_Fixed = new DateTime(2022, 10, 03), Time_In_Fixed = "Absent", PC_Name = "", Acc_Name = "" });
events.Add(new Events { Id = 4, Date_Time_Fixed = new DateTime(2022, 10, 09), Time_In_Fixed = "Absent", PC_Name = "", Acc_Name = "" });
return View(events);
}
}
View
@model List<Colour_TableRowData.Models.Events>
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$("#example tbody tr").each(function () {
var date = $(this).find('td').eq(0).html();
if (date.indexOf('Sunday') != -1) {
$(this).attr('style', 'background-color:red;');
}
});
});
</script>
</head>
<body>
<div class="container">
<table id="example" class="display table">
<thead>
<tr>
<th>Date</th>
<th>In Time</th>
<th>PC Name</th>
<th>Account</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr class="even pointer">
<td>@item.Date_Time_Fixed.ToString("dd-MMM-yyyy dddd")</td>
<td>@item.Time_In_Fixed</td>
<td>@item.PC_Name</td>
<td>@item.Acc_Name</td>
<td>
@Html.ActionLink("Change", "ChangeAttendance", "Employees", new { id = item.Id }, new { @class = "btn btn-primary pull-right fa fa-pencil" })
</td>
</tr>
}
</tbody>
</table>
</div>
</body>
</html>
Screenshot