Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between AutoPostBack=True and AutoPostBack=False?

What's the difference between AutoPostBack=True and AutoPostBack=False?

like image 256
bindu Avatar asked Aug 29 '12 08:08

bindu


People also ask

What is AutoPostBack true?

Autopostback is the mechanism by which the page will be posted back to the server automatically based on some events in the web controls. In some of the web controls, the property called auto post back, if set to true, will send the request to the server when an event happens in the control.

What is the difference between postback and AutoPostBack?

A postback is initiated by the browser, and reloads the whole page, usually when a control on the page (e.g. a button) is changed. With some controls (e.g. Checkboxes), you choose if changing the control should result in a postback. This property is called AutoPostback.

What is AutoPostBack property in ASP.NET with example?

The AutoPostBack property is used to set or return whether or not an automatic post back occurs when the user selects an item in a list control. If this property is set to TRUE the automatic post back is enabled, otherwise FALSE.

Which web controls are set with the AutoPostBack property to true by default?

Any Control that has its AutoPostBack Property set to true is connected to the _doPostBack() function using the onclick or onchange attributes. These attributes indicate what action should Browser take in response to the Client-Side javascript events onclick and onchange.


2 Answers

Taken from http://www.dotnetspider.com/resources/189-AutoPostBack-What-How-works.aspx:

Autopostback is the mechanism by which the page will be posted back to the server automatically based on some events in the web controls. In some of the web controls, the property called auto post back, if set to true, will send the request to the server when an event happens in the control.

Whenever we set the autopostback attribute to true on any of the controls, the .NET framework will automatically insert a few lines of code into the HTML generated to implement this functionality.

  1. A JavaScript method with name __doPostBack (eventtarget, eventargument)
  2. Two hidden variables with name __EVENTTARGET and __EVENTARGUMENT
  3. OnChange JavaScript event to the control
like image 110
Vishal Suthar Avatar answered Sep 30 '22 12:09

Vishal Suthar


AutoPostBack = true permits control to post back to the server. It is associated with an Event.

Example:

<asp:DropDownList id="id" runat="server" AutoPostBack="true" OnSelectIndexChanged="..."/> 

The aspx page with the above drop down list does not need an asp:button to do the post back. When you change an option in the drop down list, the page gets posted back to the server.

Default value of AutoPostBack on control is false.

like image 21
Aghilas Yakoub Avatar answered Sep 30 '22 13:09

Aghilas Yakoub