In ASP.NET, 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, Dropdown Box (Combo box) web control has the property autopostback. If we set the property to true, when ever user selects a different value in the combo box, and event will be fired in the server. i.e. a request will be send to the server.
Why we need to send a request to the server in this case?
Consider this scenario where the web page is used for entering the user information. The page contains two combo box controls State and Town. When user selects the state, the appropriate towns should be filled in the town combo box which is loaded from the database. For achieving this requirement, we can set the autopostback property of state combo box to true. If we do that we can handle the event in the server side and write code to populate the town combo box with the values from the database.
This is how we use the autopostback property. Here is another example for the autopostback usage with another control which will give much better understanding.
Consider a login page, which contains text fields User ID, User Name and Password fields. User name text box will not be editable. So the requirement will be like this, when user enters the user id and clicks tab, his name should be displayed in the User Name text field. For achieving this we have to make autopostback property of the user id textfield to true and handle the event in the server side, In the event handler, we have to write code to fetch the user name from the database for the user id ,which we will be getting from the user id text box.