By: Dan Hurwitz and Jesse Liberty
The page exposes the IsPostBack property. This is a read-only Boolean property that indicates if the page or control is being loaded for the first time, or if it is being loaded in response to a client postback. Many expensive operations (such as getting data from a database or populating ListItems) must be performed only the first time the page or control is loaded. If the page is posted to the server and then reloaded, there is no need to repeat the operation. By testing the value of IsPostBack, you can skip the expensive operation, as in the code snippets in Example 1 and Example 2.
Example 1. Testing for IsPostBack in VB.NET
sub Page_Load(ByVal Sender as Object, _
ByVal e as EventArgs)
if not IsPostBack then
' Do the expensive operations only the
' first time the page is loaded.
Example 2. Testing for IsPostBack in C#
void Page_Load(Object sender, EventArgs e)
if (! IsPostBack)
// Do the expensive operations only the
// first time the page is loaded.
This is a very informative article. Thanks for sharing your knowledge. I have fin
View Tutorial By: Andrew Deniel at 2013-05-29 11:42:43
5. Nice explaination.. But wats the use of it? Can i restrict my page to reload when i clicked button f
View Tutorial By: kavita at 2013-04-04 07:10:14
7. Buenisimo, me ayuda a salir de un problema, cosas sencillas y simples pero siempre necesitamos una g
View Tutorial By: Emilio, Guatemala at 2012-09-25 15:33:11
13. Thank You So Much . .. .. .
Very Nice Explanation.
View Tutorial By: salman at 2012-07-05 13:22:11
15. I thought it is big concept but the example which you have given makes me to understand so simple .
View Tutorial By: Nambu karthy.R at 2012-06-27 13:18:20
Most Viewed Articles (in Asp )
Latest Articles (in Asp)
Comment on this tutorial
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews