Pages

Monday, May 27, 2013

Postback and Autopostback in asp.net

ispostback=true -page is being loaded in response to a client postback.
ispostback=false -the page is loaded for the first time.

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.
A callback is initiated by java script in the page, and can load/update parts of the page, e.g. by manipulating the DOM

 Note:

AutopostBack posts the page to the server automatically whenever some changes is done in that controls data. Like Textbox text is changed it is automatically posted to server.
Dropdownlist selected value changed.

IsPostBack is used to check page is loaded for the first time or is reloaded. eg:
if page is loaded for first time we enter the value in dropdownlist from database. If the page is reloaded we are not going to enter that value again. So we check for
IsPostBack condition

No comments:

Post a Comment