PostBack is the name given to the process of submitting an ASP.NET page to the server for processing . PostBack is done if certain credentials of the page are to be checked against a database (such as verification of username and password). This is something that a client machine is not able to accomplish and thus these details have to be ‘posted back’to the server.
– A simple example to illustrate the usage of PostBack is a login page. After the user has typed his username and password, he clicks on the ‘Login’ button. Upon the click, the page is sent to the server to check against the database/XML file to check if the user with supplied details is an authenticated user.
– Usage of IsPostBack in ASP.Net
– IsPostBack is a Boolean property of a page when is set (=true) when a page is first loaded. Thus, the first time that the page loads the IsPostBack flag is false and for subsequent PostBacks, it is true. An important point to be noted here is that each time a PostBack occurs, the entire page including the Page_Load is ‘posted back‘ and executed.
– Thus a very common programming practice is that whenever some part of the code is to be executed just the first time a page loads, it is checked against the IsPostBack flag.
(Visited 1 times, 1 visits today)