This is asked many times on asp.net forums,
2. How to call Server Side methods Client Side in ASP.Net
Now the answer is using jQuery.
jQuery allows you to call Server Side ASP.net methods from client side without any PostBack. Actually it is an AJAX call to the server but it allows us to call the method or function defined server side.
The figure below describes the syntax of the call.
Client Side Methods
Above the ShowCurrentTime method makes an AJAX call to the server and executes the GetCurrentTime method which accepts the username and returns a string value.
Server Side Methods
The above method simply returns a greeting message to the user along with the current server time. An important thing to note is that the method is declared as static (C#) and Shared(VB.Net) and also it is declared as Web Method unless you do this you won’t be able to call the methods
The figure below displays the output displayed to the user when the button is clicked
The above code has been tested in the following browsers
* All browser logos displayed above are property of their respective owners.
You can download the code in VB.Net and C# using the link belowCallingServerSideMethodsJQuery.zip