0

I want to use JavaScript code to call the code behind method. I tried something but it isn't working.

JavaScript code:

<script type="text/javascript">  
    function checkMe() {  
        alert("hello");  
        PageMethods.Counting;  
    }

    function onComplete(result, response, content) {  
        alert(result);  
    }  
</script>

Below is my dynamically created <a href=""> tag:

string.Format(@"<a href='{0}' onclick='checkMe();' runat='server'>{1}</a>", newlink.NavigateUrl, dt.Rows[contID]["FAQTITLE"].ToString()) ; 

When I click the <a href=""> tag how do I call the below method?

protected void Counting(object sender, EventArgs e)  
{  
    //my code is here   
}  
nateyolles
  • 1,851
  • 5
  • 17
  • 23
ekrem tapan
  • 147
  • 4
  • 15

0 Answers0