What is isPostback?
Postback is a way to send information from the client to the server and after processing it back to the client. So sometimes in our project we need to check whether the page loading is done by the user action(for eg. Button click) or it is an initial loading of the page. To check this we have a property of the page called isPostback property.
It is mainly used in pageloads to check whether the page loading is done by the initial request or not.
Let us look one example to make this more clear.
For example, if we want to display a name as "guest" in a label on the initial loading of the page and then take a username from the user and display it in that label.
To do this we need to keep in mind that we need the name "guest" only when the page is first loaded and after the button click we need to show the name of the user that is entered in the textbox.
Design
Output
On initial load:
After entering my name and clicking the display button:
You may click the Content tab to see all the posts that i will cover in this tutorial for easy navigation.
Design
Code Behind
On initial load:
After entering my name and clicking the display button:
No comments:
Post a Comment