5
Answers

use javascript calling code behind function.

Ekrem Tapan

Ekrem Tapan

8y
244
1
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)