Imagine we have two class names: "holdRow" for a blue background and "HighlightHoldRow" for a yellow background. By utilizing the code below, the method "RowSelect" is called when a row is selected.
Here is the code snippet:
.holdRow td {
font-weight : bold !important;
color: Blue !important;
}
.higLightholdRow td {
font-weight : bold !important;
color: Yellow !important;
}
var LastRowId = "";
function RowSelect(id) {
if (Flag == "TRUE") {
var grid = $('#gvName);
if (LastRowId != "" && LastRowId != undefined && LastRowId != id) {
tr = grid[0].rows.namedItem(LastRowId);
$(tr).removeClass("higLightholdRow");
$(tr).addClass("holdRow");
LastRowId = "";
}
tr = grid[0].rows.namedItem(id);
$(tr).removeClass("holdRow");
$(tr).addClass("higLightholdRow");
LastRowId = id;
}
}
ClientSideEvents-RowSelect="RowSelect"
The RowSelect function is triggered when a row is selected. The selected row will have a yellow background color while the remaining rows will have a blue background color.