Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
50
Change cell color
posted

I am validating the cell value in the grid.If the value not available(null) then the cell background color needs to change.

The below code working only for odd rows, for even rows the cell background color is not changing.

Is there any other way to do that

Thanks in advance!

 

 

var cols='Col1,Col2';

function IsGridValid(cols) {
        var arr = new Array();
         arr = cols.split(',')
         var gridid = "<%=grdCRDR1.ClientID%>"
         var grid = igtbl_getGridById(gridid);

         for (var i = 0; i <= grid.Rows.length - 1; i++) {
                 for (var cnt = 0; cnt <= arr.length-1; cnt++) {
                     var Row = grid.Rows.getRow(i);
                     var cell = Row.getCellFromKey(arr[cnt]);
                     alert(cell.getValue());
                     if (cell.getValue() == null) {
                         cell.Element.style.backgroundColor = "#FF0000";
                     }
                     else {
                         cell.Element.style.backgroundColor = "#FFFFFF";
                     }
                 }
             }
         return false;
     }

Parents
No Data
Reply Children
No Data