How to Call Client Click from a Button Click in ASP.NET

This is very important technique to call a JavaScript from a button click. Sometimes we have to use it when (as you in ASP.NET programming, there are two click event one is JScript click and another is onClick event which will code behind.).

So here, I am explaining, How you can call a JavaScript function from a button click.
  1. <html>  
  2. <head>  
  3. </head>  
  4. <script type="text/javascript">  
  5.     function btnClick() {  
  6.         alert("btn clicked");  
  7.     }  
  8. </script>   
  9. <body>   
  10. <asp:Button ID="btnClick" runat="server" Text="ClickMe" OnClientClick="btnClick()"></asp:Button>  
  11. </body>  
  12. </html>