Visual Studio .NET - button autopostback property

Asked By san san on 07-Aug-08 01:53 AM
Hi all

In ASP.NET,  I have  a  button and when I click on that button the page reloads.. I want to set the auto-postback property of that button to false..
How to do that Please...


solution button autopostback property - Sakshi a replied to san san on 07-Aug-08 02:17 AM

<asp:Button id="cmd1" runat="server" autopostback="false"/>

Autopostback - Kalit Sikka replied to san san on 07-Aug-08 02:24 AM

The AutoPostBack property is used to set or return whether or not an automatic post back occurs when the user presses "ENTER" or "TAB" in the concern control.

If this property is set to TRUE the automatic post back is enabled, otherwise FALSE. Default is FALSE.


<asp:Button AutoPostBack="TRUE|FALSE" runat="server"/>

I found the answer... - Atul Shinde replied to san san on 07-Aug-08 02:29 AM

As button control dont have property as AutoPostBack.

U can use this :

Select properties of the button -> OnClientClick()

Write this : return false without double quotes.

Best of luck....


try this... - Vasanthakumar D replied to san san on 07-Aug-08 02:33 AM


try the below code...

there is no such property for button. but you avoid the postback using JS

<asp:Button Id="btn" runat="server" OnClientClick="return false" />

See this - Sagar P replied to san san on 07-Aug-08 08:36 AM

You cant set AutoPostback property of button control.

As it is a server control and when you click on it page will go to server.

Instead use can use HTML button control or you can use OnClientClick of button if you dont want to refresh a page.

<asp:Button Id="btn" runat="server" OnClientClick="return false" />

Best Luck!!!!!!!!!!!!

check... - Santhosh N replied to san san on 07-Aug-08 04:41 AM

YOu can make use of autopostback property and set that value to false

<asp:button AutoPostBack="false".../>

But, in order to execute some functionality on click of the button, you can make use of onClientClick event to execute cleint side exection depending on your requirement

Client side return false prevents server event from firing - Jim Engebretson replied to Santhosh N on 10-Dec-08 05:08 PM

btn_Save_Command server event will not fire when onClientClick return false

** Given **

<script runat="server">

Protected Sub btn_Save_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)


End Sub



<form id="form1" runat="server">

<asp:Button OnClientClick="return false" ID="btn_Save" runat="server" Text="Save" OnCommand="btn_Save_Command" /></td>


yeah - Santhosh N replied to Jim Engebretson on 10-Dec-08 09:57 PM
yes, that is expected behaviour and you need to return appropriate value to do so in alignment to ur requirement

wysiwyg editor and postback - Jim Engebretson replied to Santhosh N on 10-Dec-08 10:17 PM

It would be great if I could call the write_text procedure without doing a postback. When postback happens, the cursor within the freetextbox editor changes from last position to the first position; annoying the users.