0

I need help, I want to call a method from c# code behind aspx in javascript. My code in javascript is not working in Site.Master. And I also can't fix my error: The name does not exist in the current context:

  function SendNoResponse() {
  
     <%#btnCallCSFunction_Click() %>;
            }

Thank you!!

  • Don't know for sure if this might work: Is the C# function binded to a button? Then you can select the button with Javascript (by adding a id to it) and trigger a click. – Bram Apr 24 '17 at 12:04
  • 1
    Web applications don't work like this... The javascript code is running on the client and the C# code is running on the server... You need to make an ajax call or post back... What are you using? Webforms? Asp.Mvc? – Milney Apr 24 '17 at 12:05
  • Depending on what it is the event function is supposed to do, you can mark the function with the `[WebMethod]` attribute, and make it `static`. Then you can make an `ajax` call easily enough. – Drew Kennedy Apr 24 '17 at 12:07
  • Why do you want to do this? – LiverpoolOwen Apr 24 '17 at 12:07
  • I need this after the onload page. I have timeout function in javascript – catherineCoder Apr 24 '17 at 13:27

0 Answers0