Ekrem Tapan

Ekrem Tapan

  • NA
  • 967
  • 81.2k

use javascript calling code behind function.

Jun 20 2016 10:15 PM
hi. 
i want to use javascript code then call to code behind method. im trying some thing but something is wrong not working . anybody can help me ?
  1. <script type="text/javascript">  
  2. function checkMe() {  
  3. alert("hello");  
  4. PageMethods.Counting;  
  5. }  
  6. function onComplete(result, response, content) {  
  7. alert(result);  
  8. }  
  9. </script>  
 when i  click to <a href=""> tag how to call the below function ? 
  1. string.Format(@"<a href='{0}' onclick='checkMe();' runat='server'>{1}</a>", newlink.NavigateUrl, dt.Rows[contID]["FAQTITLE"].ToString()) ;  
and then my code behind method what i want to call 
 
  1. protected void Counting(object sender, EventArgs e)  
  2. {  
  3.     //my code is here   
  4. }  

Answers (5)