viernes, 29 de noviembre de 2013

recorrer un gridview de asp.net con javascript

 <script language="JavaScript" type="text/javascript">
         function ChangeAllChecks(gridViewName) {
             var tabla = document.getElementById(gridViewName);
             for (i = 1; i < tabla.rows.length; i++) {
//                 if (i != (fila + 1))
//                     if (tabla.rows[fila + 1].cells[3].innerHTML == tabla.rows[i].cells[3].innerHTML)
                   tabla.rows[i].cells[1].firstChild.checked = true;
             }
         }

         function ChangeAll(gridViewName)
          {
              var tabla = document.getElementById(gridViewName);
            
              celdas = tabla.cells;
             for (i = 0; i < celdas.length - 1; i++) {
//                alert(celdas[i].lastChild.name);

                if (celdas[i].firstChild.type == "div") {
                     //alert('hola');
                      celdas[i].firstChild.style.display = 'block';
                 }
             }

         }

         function pintaxlang(gv,fila) {


             var tabla = document.getElementById(gv);
             var txt = document.getElementById('TextBox1');
             txt.value = fila;
             fila = fila + 1;
             celdas = tabla.cells;
             tabla.rows[fila].cells[0].style.backgroundColor = "#66ff33";
             tabla.rows[fila].cells[1].style.backgroundColor = "#66ff33";
             tabla.rows[fila].cells[2].style.backgroundColor = "#66ff33";


             for (i = 1; i < tabla.rows.length; i++) {
                 if (i != fila )
                 {
                     tabla.rows[i].cells[0].style.backgroundColor = "#ffffff";
                     tabla.rows[i].cells[1].style.backgroundColor = "#ffffff";
                     tabla.rows[i].cells[2].style.backgroundColor = "#ffffff";
                 }
             }
           

         }
    </script>

No hay comentarios: