what is ispostback in asp.net with example?

 

ASP.NET Page is a Single Form Component. That is, there can be only one <form> Element on an ASP.NET Page known as WebForm and all Web Controls of that Webpage can be containerized into the corresponding <form> Element. Submission Controls and Links can also be on the same WebForm.

When the user submits this form, then all the contents of the current form are sent by default to the server page of the current page itself. That is, in the action Attribute of <form> Element by default, the URL of the current page is specified as the specified value. Therefore, the action of posting the content of the current page back to the current page itself is known as Postback.

In other words, our webpage is a part of our application, which consists of Visual User Interface Elements visible to the user as well as some Program Logic, which processes the interactions made by the User Interface.

Clicking a Submit Button or Link gives the Web Browser an Instruction to perform a Request for the same page on which it is Button / Link Exist. Therefore, clicking on the Submit Button / Link, Web Browser also sends the Contest of various Web Controls to the Exist on the WebForm of the Current Page to the Web Server, which is again received on the same page from which the request was sent. has gone. Whereas, ASP.NET Runtime on a Web Server completes a Request by executing the same code as the same Webpage during the process of processing that incoming Request.

We can understand the relationship between Button Control and its associated Event Handler Code by the following markup, which was written to create a Button on ASP.NET Page and Specify the Event Handler to be executed when that Button is clicked. has gone:

When this is Markup Run, the Server-Side Event Handler is actually executed through a Client-Side Event which is usually a JavaScript Event and the Program Logic Codes of this Server-Side Event Handler are specified as follows By modifying the state of the server-side controls, we can update the user-interface of the client-side.

As a result, when the above Event-Handler Code Execute specified in the Server-Side is executed, all the Server Controls on the webpage are updated to Exactly hold the value that was last Execute for that page. Also, if the content of control of a page has been dynamically changed by the Specified Event Handler Code as mentioned above, as the text of the lblMessage Control has been done, then that change in the content of that control is also reflected on the webpage.

That is, after submitting a form once in a webpage due to the web being based on the stateless protocol, if the response is being received again on the same page, then the data of all the controls on that page is complete. because the first request is not related to the second request.

But when we create an ASP.NET based webpage, although the response received by submitting the form is received by default on the same page, the data of different controls in the WebForm of that page are not completely cleared. , Rather, the content that they contain at the time of the last request is performed, at least those content remain to Exist in those controls during the next request.

In ASP.NET, the Stateful Behavior that is derived from the feature of ASP.NET Platform is known as Postback and it is because of this Postback Feature that the Visual Basic Programmers of the 1990s were very easy for web development. Started using ASP.NET.

Because Microsoft simplified Web Technologies based on Stateless Protocol like Stateful based Desktop Technology. Due to which desktop programmers could easily become web programmers and this is what Visual Basic Desktop Developers of that time wanted.

Leave a comment