I found a solution to this problem using jQuery, I added a CSS class attribute for the internal HTML grid column. This is the previous code with the attribute added
@{ var grid = new WebGrid(Model, canPage: true, rowsPerPage: 20); @grid.GetHtml(tableStyle: "grid", rowStyle: "gridrow", alternatingRowStyle: "gridrow_alternate", mode: WebGridPagerModes.All, numericLinksCount: 10, columns: grid.Columns( grid.Column("Name", "Name", item => (item.LocationData[0].Name), canSort: true, style: "width:60%"), grid.Column("Url", "Url", canSort: false, style: "width:60%"), grid.Column("Edit", "", @<a href='../VenHome/Edit/@item.ID' ><img src='/content/icons/edit.png' alt='Edit' /></a>, style: "width:150px"), grid.Column("Delete", "", @<a href='#' id='Delete' class="temp" removed="@item.Removed" itemId='@item.ID' title='@item.LocationData[0].Name'><img src='/content/icons/delete.png' alt='Delete' /></a>, style: "width:150px"), grid.Column("Details", "", @<a href="../VenHome/Details/@item.Id" title="Details"> <img src="../../Content/Icons/Details.png" alt="Details" /></a>) )); }
This is a code modified
grid.Column("Delete", "", @<a href='#' id='Delete' class="temp" removed="@item.Removed" itemId='@item.ID' title='@item.LocationData[0].Name'><img src='/content/icons/delete.png' alt='Delete' /></a>, style: "width:150px"),
I added the "temp" class to the delete link, and also adding the "remove" attribute has a condition value, and I added the following jQuery code
$(".temp").each(function (index, element) { if (($(element).attr("removed")) == "False") { $(element).parent().parent().attr("class", "deleted"); $(element).find("img").attr("src", "../../content/icons/deleted.png"); } });
Note: if the item is deleted, the line is displayed as darkened.