Calling Postback from Javascript

There may be some scenario where you may want to explicitly postback to the server using some clientside javascript. It is pretty simple to do this. ASP.NET already creates a client side javascript method as shown below to support Postbacks for the web controls:

So, all you have to do is, just call this method with appropriate arguments. You may call this as shown below:

However, it is not recommended to use this method name directly in the client side. The best approach is, generate this piece of code from the code behind file using ASP.NET. This way, … Click here to continue…..

How to add watermark on a textbox by using javascript?

There are 3 ways to add watermark functionality on a textbox by using javascript.



this function call on body onload event

How to disable back button of browser?

By using java script it can be done



Calling Server Code by using javascript

Implementing Client Callbacks Programmatic Without Post-backs in ASP.NET Web Pages How can we call c# server side code by using java-script. Here i am given you an example in which i described that how to call it Use this code in aspx page

and use this code in aspx.cs page

This is the best way to use c# server side code by using java-script  instead of static function web method which calls from page method. For more reference: MSDN Link…