What's the difference between AutoPostBack=True
and AutoPostBack=False
?
问题:
回答1:
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.
- A JavaScript method with name __doPostBack (eventtarget, eventargument)
- Two hidden variables with name __EVENTTARGET and __EVENTARGUMENT
- OnChange JavaScript event to the control
回答2:
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.
回答3:
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.
回答4:
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.
回答5:
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 TextBox control.
If this property is set to TRUE the automatic post back is enabled, otherwise FALSE. Default is FALSE.
回答6:
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.
回答7:
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
.
回答8:
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
回答9:
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.
回答10:
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.