Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/11/2015, 14:54
miguelito26_aries
 
Fecha de Ingreso: noviembre-2015
Mensajes: 1
Antigüedad: 8 años, 5 meses
Puntos: 0
Capturar valores seleccionados de los checkbox

Hola estoy trabajando con MVC3 C#
necesito capturar los valores de los ID de los elementos que yo seleccione, tengo este codigo.

Código Javascript:
Ver original
  1. <script>
  2.     $("#btnImprimir").click(function () {
  3.  
  4.  
  5.  
  6.  
  7.         var sid = new Array($("sid").val());
  8.         //alert(sid);
  9.  
  10.         //var sid = [3,6,9]
  11.         fc_VerReporteMaster(sid)
  12.  
  13.        
  14.  
  15.  
  16.     });
  17.  
  18.  
  19.     function fc_VerReporteMaster(sid) {
  20.         var ruta = $("#Ruta_Server").val();
  21.         var tipo = "rptRequerimientoGeneral";
  22.  
  23.         //var ID = [1,3,9];
  24.         var contador = 0;
  25.         var cadena = "";
  26.         for (contador = 0; contador < sid.length; contador++) {
  27.             if (contador < (sid.length - 1))
  28.                 cadena += sid[contador] + ",";
  29.             else
  30.                 cadena += sid[contador];
  31.  
  32.         }
  33.  
  34.  
  35.         var url = ruta + "/BandejaImpresion.aspx?tipo=" + tipo +
  36.                            "&p1=" + cadena;
  37.  
  38.         window.open(url);
  39.  
  40.     }
  41. </script>

Código HTML:
Ver original
  1. @using (Html.BeginForm("Edit", "Requerimiento176", FormMethod.Post))
  2. {
  3.  
  4.    
  5.    
  6.     <div class="contenedor">
  7.         <h6>Resultado de Búsqueda</h6>
  8.         <table class="tablagrilla" style="width: 100%" id="tabla">
  9.             <thead>
  10.  
  11.                 <tr>
  12.                     <th style="text-align: center">
  13.                         <input type="checkbox" name="chkAll" value="All" id="chkAll" />
  14.                     <th>ID
  15.                     </th>
  16.                     <th>Número
  17.                     </th>
  18.                     <th>Aportante
  19.                     </th>
  20.                     <th>Fecha Emisión
  21.                     </th>
  22.                     <th>Periodo Tributario
  23.                     </th>
  24.                     <th>Cantidad UIT
  25.                     </th>
  26.                                        
  27.                     <th>Estado
  28.                     </th>
  29.                     <th>Observación
  30.                     </th>
  31.                     <th>Tipo Infracción
  32.                     </th>
  33.                     <th colspan="3"></th>
  34.                 </tr>
  35.             </thead>
  36.             @foreach (var item in Model.oT_RFAM_RequerimientoMultaEntidad)
  37.             {
  38.                 <tr>
  39.                     <td style="width: 3%; text-align: center">
  40.                         <input type="checkbox" name="sid" value="@item.id_requerimientomulta" class="sid"  />
  41.                     </td>
  42.                     <td style="text-align: center">
  43.                         @Html.DisplayFor(modelItem => item.id_requerimientomulta)
  44.                     </td>
  45.                     <td>
  46.                         @Html.DisplayFor(modelItem => item.numerorequerimiento)
  47.                     </td>
  48.                     <td style="text-align: left">
  49.                         @Html.DisplayFor(modelItem => item.RazonSocial)
  50.                     </td>
  51.                     <td>
  52.                         @Html.DisplayFor(modelItem => item.Fecha_Emision)
  53.                     </td>
  54.                                        
  55.                     <td>
  56.                         @Html.DisplayFor(modelItem => item.PeriodoTributario)
  57.                     </td>
  58.                     <td>
  59.                         @Html.DisplayFor(modelItem => item.cantidaduit)
  60.                     </td>
  61.                                        
  62.                     <td>
  63.                         @Html.DisplayFor(modelItem => item.Estado)
  64.                     </td>
  65.                     <td>
  66.                         @Html.DisplayFor(modelItem => item.Observacion)
  67.                     </td>
  68.                     <td>
  69.                         @Html.DisplayFor(modelItem => item.Infraccion176)
  70.                     </td>
  71.                    
  72.                     <td>
  73.  
  74.                         @if ((item.id_tipoestado != 5 && item.id_tipoestado != 26))
  75.                         {
  76.                         @Html.ActionLink("Editar", "Edit", new { id = item.id_requerimientomulta })
  77.                         }
  78.                         else
  79.                         {
  80.                         <text>Editar</text>
  81.                         }
  82.  
  83.                    </td>
  84.  
  85.  
  86.                    <td>
  87.  
  88.                        @if ((item.id_tipoestado != 5 && item.id_tipoestado != 26))
  89.                        {
  90.                            <a href="JavaScript:ValidarRequerimiento(@item.id_requerimientomulta)">Anular</a>
  91.                        }
  92.                        else
  93.                        {
  94.                            <text>Anular</text>
  95.                        }
  96.  
  97.                    </td>
  98.  
  99.                    <td>
  100.                        @if ((item.id_tipoestado != 5))
  101.                        {
  102.                            <a href="JavaScript:fc_VerReporteMaster(@item.id_requerimientomulta)">Imprimir</a>
  103.                        }
  104.                        else
  105.                        {
  106.                            <text>Imprimir</text>  
  107.                        }
  108.                    </td>
  109.                </tr>
  110.            }
  111.  
  112.        </table>
  113.    </div>
  114. }

lo que yo quiero es que mi boton imprimir capture esos valores en un array y los envie a la funcion fc_VerReporteMaster, es lo unico que me falta hacer.