Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

195
Vistas
Why isn't my WebMethod being called from javascript?

I'm working in ASP.Net 4. I have the following within the body tag of my aspx:

<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server"/> 
  <script type="text/javascript">
      function Process() {
          var CHK = document.getElementById("<%=lstAffEmployees.ClientID%>");
          var checkbox = CHK.getElementsByTagName("input");
          var counter = 0;
          for (var i = 0; i < checkbox.length; i++) {
              if (checkbox[i].checked) {
                  counter++;
                  var Attorney = label[i].innerHTML;
                  var cutoff = Attorney.indexOf('[');
                  var cAttorney = Attorney.substring(0, cutoff - 1);
                  PageMethods.saveData(checkbox[i].value, cAttorney);
                  
              }
              
          }
          return true;
      }
</script>

In my code-behind, I have:

 [WebMethod]
    public static void saveData(string attyNo, string attyName)
    {
        //mycode
    }

In debugging, I get to the PageMethods call in the javascript, but then saveData in my code-behind is never called. I don't understand why not. Can anyone help?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda