How is Page.IsPostback implemented ?

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.
 
M

Marshal Antony

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
 
A

Anatoly

if request type is GET when IsPostBack is false.
if request type is POST when IsPostBack is true
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top