what is postback?

M

Matt

I always see the term "postback" from ASP book, but I am not sure if I fully
understand the meaning. Here's my understanding so far, please correct me if
any mistakes.

Here's a typical html form:
<form action="process.asp" method="post">
'GUI code
</form>

"postback" action happens when the user click the submit button, that means
it will invoke "process.asp" is the above code.

In ASP.NET, if the web control has set AutoPostBack property to True, that
means when there is any events on the web control, it will invoke
"process.asp", just like the user click the submit button.

Please advise. Thanks!
 
A

Ajay [MVP .NET]

Matt,
Postback is something that happens whenever the server
gets a request for this page from the second time onwards
It need not be mandatorily a submit button, probs even a
click which requiers a server side validation is also
results in a postback.

Postback is sending back the page some information
irrespective of either it is submit or a name for
validation.


Ajay
 
J

Jeff Cochran

I always see the term "postback" from ASP book, but I am not sure if I fully
understand the meaning. Here's my understanding so far, please correct me if
any mistakes.

Here's a typical html form:
<form action="process.asp" method="post">
'GUI code
</form>

"postback" action happens when the user click the submit button, that means
it will invoke "process.asp" is the above code.

In ASP.NET, if the web control has set AutoPostBack property to True, that
means when there is any events on the web control, it will invoke
"process.asp", just like the user click the submit button.

Basically the same. Postback just means that when the form is
submitted, the same script that created the form does the processing.
So in your case, the file would be process.asp, and when submitted,
the form would pass the values to process.asp, invoking itself again.

Jeff
 
S

Scott M.

In addition to the other posts, be aware that a postback is not the same
thing as a refresh. In other words, a postback does not just represent the
second (or subsequent) time the page is being loaded. A postback represents
just what its name says: a post-back of data to the server.

Usually, a submit button causes a postback, but as you've pointed out, many
controls have an "AutoPostBack" property which, when set to true, make using
that particular control act as if it was a submit button.
 
M

Matthew Louden

Let's use the example and assume this is in process.asp

When we click the submit button, the form will send the data in web control
to the server, and then call "process.asp." Since the form is in
process.asp, and "process.asp" is the form to call, so it makes us think the
page is being loaded again, or have the same effect as refresh the page. The
smart navigation property is to prevent the page from blinking?

Please advise! Thanks!
 
S

Scott M.

Matthew Louden said:
Let's use the example and assume this is in process.asp

Actually, the line would look like this:

<form method="post" runat="server">

Since, ASP.NET forms are server-side forms and server-side forms MUST submit
to themselves (even if you put Action="someOtherPage.aspx", it will
disregard that and submit to itself).
When we click the submit button, the form will send the data in web control
to the server, and then call "process.asp." Since the form is in
process.asp, and "process.asp" is the form to call, so it makes us think the
page is being loaded again, or have the same effect as refresh the page.

The page is being loaded again, but this time it has form data to extract
and process with. Under this circumstance, this page load is called a
"PostBack". A page refresh does not always cause the page to be rebuilt as
a "PostBack".
The smart navigation property is to prevent the page from blinking?

SmartNavigation causes the page to reload to the scrolled position it was in
during the last page render.
 

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,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top