Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

194
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda