You can use the PageMethods to call server side function (C#) from ClientSide(Javascript)
1) Add a script Manager to your page and set the 'EnablePageMethods' property of script manager to True.
<asp:ScriptManager ID="ScriptManager2" runat="server" EnablePageMethods="true"/>
2) Add Javascript function to the body section of page
<body>
<form id="form1" runat="server">
<script type="text/javascript">
function CallingServerSideFunction() {
PageMethods.GetData();
}
</script>
</form>
</body>
3) Add the method you want to call in c#
//Please note that the method should be a Static and WebMethod.
[System.Web.Services.WebMethod]
public static void GetData()
{
MessageBox.Show("Calling From Client Side");
//Your Logic comes here
}
4) Calling the Javascript function
<input id="Button2" type="button" value="FunctionCall" onclick="CallingServerSideFunction()" />