Difference between AutoPostBack=True and AutoPostBack=False?
Asked Answered
F

9

47

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

Flourish answered 29/8, 2012 at 8:40 Comment(0)
S
41

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
Steradian answered 29/8, 2012 at 8:48 Comment(0)
T
15

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.

Tercentenary answered 29/8, 2012 at 8:42 Comment(0)
O
10

AutopostBack is a property which you assign to web controls if you want to post back the page when any event occurs at them.

You may see this article: What is AutoPostBack?

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, which if set to true, will send the request to the server when an event happens in the control

For example, TextBox has AutoPostBack property

Use the AutoPostBack property to specify whether an automatic postback to the server will occur when the TextBox control loses focus. Pressing the ENTER or the TAB key while in the TextBox control is the most common way to change focus.

Ovi answered 29/8, 2012 at 8:47 Comment(0)
V
4

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

If this property is set to TRUE the automatic postback is enabled, otherwise FALSE. The default is FALSE.

Vindicate answered 11/2, 2014 at 10:49 Comment(0)
P
2

There is one event which is default associate with any webcontrol. For example, in case of Button click event, in case of Check box CheckChangedEvent is there. So in case of AutoPostBack true these events are called by default and event handle at server side.

Proffitt answered 29/8, 2012 at 9:31 Comment(0)
A
2

AutopostBack :

AutopostBack is a property of the controls which enables the post back on the changes of the web control.

Difference between AutopostBack=True and AutoPostBack=False:

If the AutopostBack property is set to true, a post back is sent immediately to the server

If the AutopostBack property is set to false, then no post back occurs.

Ayeaye answered 5/10, 2016 at 9:32 Comment(0)
E
1

AutoPostBack property:

Asp.net controls which cannot submit the Form (PostBack) on their own and hence ASP.Net has provided a feature using

 AutoPostBack = "true"

: which controls like DropDownList, CheckBoxList, RadioButtonList, etc. can perform PostBack(when clicked on it).

And

AutoPostBack = "false"

It is the by default state of controls which can perform Postback on button submit.

Ensphere answered 8/1, 2018 at 21:35 Comment(0)
H
0

hai sir

There is one event which is default associate with any webcontrol. For example, in case of Button click event, in case of Check box CheckChangedEvent is there. So in case of AutoPostBack true these events are called by default and event handle at server sid

Hoekstra answered 9/7, 2014 at 2:38 Comment(0)
C
0

If you want a control to postback automatically when an event is raised, you need to set the AutoPostBack property of the control to True.

Cloying answered 21/9, 2016 at 8:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.