what's the difference between these two actually ? Requesting page for the first time (or hitting enter in address bar) gives Ispostback = fasle but when i refresh my page then it sets isPostback = true, why ? it should not do like this for refreshing ?

3 Years
Discussion Span
Last Post by JorgeM

The first time you access the page, asp.net knows that it was not a postback that occurred from the same page.

Since you only have one form element on the page, any time you click on a submit button or another control set to autopost back, the same page will be reloaded. You can check to see if the page was a post back using IsPostBack.

Sometimes you only want to do specfic things the first time the page is loaded, not on post back, say connect to a DB to populate data on the page, so you would check by !IsPostBack (is not postback). Or say filling a dropdown list's items. you only want to do that on a non post back.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.