viernes, 29 de noviembre de 2013

convertir a entero en javascript

parseInt(cantidad2)

trabajar con el evento change de una caja de texto con jquery en gridview asp.net


        $(document).ready(function() {

            $("#<%=gvReporteStock.ClientID%> [id*='TextBox3']").change(function() {

               
                var tr = $(this).parent().parent();
                var cantidad1 = $("td:eq(2)", tr).html();//valor de la columna
                var cantidad2 = $(this).val(); //valor de la caja de texto
                if (cantidad2 > cantidad1) {
                   // alert("No se puede exceder el stock");
                    $(this).val('0'); //asigana valor a caja de texto
                }

            });

        });

obtener el nombre del control de un grigview con javascript

onclick ="javascript:ChangeAllChecks(this.offsetParent.offsetParent.id)"

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>

jueves, 28 de noviembre de 2013

reindexar reorganizar en sql server


--reindexar
ALTER INDEX ALL ON DETALLE
REBUILD WITH (FILLFACTOR = 80, SORT_IN_TEMPDB = ON,
              STATISTICS_NORECOMPUTE = ON);

--reorganizar

ALTER INDEX ALL ON SALIDA REORGANIZE 


agregarle atributos a caja de texto de un gridview

  protected void gvReporteStock_RowDataBound(object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowType == DataControlRowType.DataRow)
        {

            (e.Row.FindControl("TextBox3") as TextBox).Attributes.Add("onkeydown", "soloNumeros();");
           
        }
    }

dar formato entero a caja de texto dentro de gridview





Bind("cantidad", "{0:F0}")