How is Page.IsPostback implemented ?

  • Thread starter Thread starter Pravin
  • Start date Start date
P

Pravin

Hi,

I have a doubt that how does ASP.NET find out whether the page is accessed
for the first time or the page is due to a post back event, and then set
the IsPostBack property ?

Any ideas.

Pravin.
 
Hi Pravin,
In the Page_Load event,
In C#,
if(!IsPostBack){
code to execute before the first round trip..this happens
when the page is loaded for the first time
}
In VB.NET,
If Not IsPostBack Then
code to execute before the first round trip..this happens when the
page is loaded for the first time
End If
How this works is that the Page object keeps a record of whether
or not a form has been submitted by the user
in IsPostBack.If the has been submitted ,in that case IsPostBack returns
true else it returns false.
To learn about the ASP.NET page object model,here is a very good
article on MSDN:

http://msdn.microsoft.com/library/d.../en-us/dnaspp/html/aspnet-pageobjectmodel.asp
Hope this helps.
Marshal Antony
..NET developer
http://www.dotnetmarshal.com
 
if request type is GET when IsPostBack is false.
if request type is POST when IsPostBack is true
 
Back
Top