How to call ASP.NET function or method from JavaScript?

Most of the times we need to call ASP.NET function or method from the javascript, we can do this, by creating one button (invisible mode) and call that button from the javascript button.

Example:
<div style="display:none; color:green;">
      <asp:Button runat="server" id="btnCalling" Onclick="btnJavascriptHandlerMethod" />
</div>

from our java script code we can use client id for at the time of doing action.

var objButton=document.getElementByID("btnCalling");
objButton.click();

If you have any queries Please fell free to ask in comments section. 
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar