Can I avoid postback on button click (don't go in page_load method),
despite, Call the handler directly.
I tried html button, asp button, link button, but didn't get my goal.
Is it possible?
You can use OnClientClick. It will call the function (jquery function) you want to execute then use return false to avoid pageload. In your button add:
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="yourfunction(); return false;" /> If you want to call code behind function without postback then there are two ways to do this:
Use UpdatePanel. You can read this tutorial.
or Use page methods:
Add a static method to your page, decorated with the WebMethod attribute:
[WebMethod] public static void MyMethod(string Param) { } Enable page methods in your ScriptManager:
<asp:ScriptManager EnablePageMethods="True" ... /> And then you can call it from the client side, using JavaScript (OnClientClick event of your button).
PageMethods.MyMethod("value", successCallback, errorCallback); For more details read: http://msdn.microsoft.com/en-us/library/bb398998.aspx
Hope it will help you..!
Use javascript if you want to disable post back try the below code
<asp:button runat="server".... OnClientClick="myfunction(); return false;" /> by doing this,it will cancel the postback
Call event handler without postback, Is it possible?Yes, it is all you need to do is wrap your button and other content inside Update Panel.