I coded one java script for changing color of a cell of a gridview in asp.net.The function is given below.
function hello() {
var gvDrv = document.getElementById("<%= gridviewSearchResult.ClientID %>");
for (i = 1; i < gvDrv.rows.length; i++) {
var cell = gvDrv.rows[i].cells;
var HTML = cell[0].innerHTML;
if (cell[1].innerHTML == "Combivent") {
gvDrv.rows[i].cells[2].className = " PendingRowStyle";
}
else {
}
}
}
If the cell content is "Combivent" , I am applying CSS class PendingRowStyle
for a column.
I'm calling this function on a button's onclientclick
event.
Now the issue is , its changing the color of the cell as per the condtion. But as soon as changed its retaining to old stage. Its just like blinking that color to the cell.Why that color is not persisting to that cell.What is the logic in that? How i have to handle this?
Note: I loaded the gridview in the pageload event , inside if(!ispostback).
Can any one give me a solution?