Tech News

What is IsPostBack?


IsPostBack

Postback is actually sending all the information
from client to web server, then web server process all those contents
and returns back to the client. Most of the time ASP control will cause a
post back (e. g. buttonclick) but some don’t unless you tell them to do
In certain events ( Listbox Index Changed,RadioButton Checked etc..) in
an ASP.NET page upon which a PostBack might be needed.


How to ispostback in asp.net

IsPostBack is a property of the Asp.Net page that
tells whether or not the page is on its initial load or if a user has
perform a button on your web page that has caused the page to post back
to itself. The value of the Page.IsPostBack property will be set to true
when the page is executing after a postback, and false otherwise. We
can check the value of this property based on the value and we can
populate the controls on the page.
Is Postback is normally used on page _load event
to detect if the web page is getting generated due to postback requested
by a control on the page or if the page is getting loaded for the first
time.

C# Source Code


protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// generate form;
}
else
{
//process submitted data;
}
}

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x