473,583 Members | 3,010 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Page.IsPostBack Property

nly
Page.IsPostBack Property

"The Page_Load subroutine runs EVERY time the page is loaded. If you want to
execute the code in the Page_Load subroutine only the FIRST time the page is
loaded, you can use the Page.IsPostBack property. If the Page.IsPostBack
property is false, the page is loaded for the first time, if it is true, the
page is posted back to the server (i.e. from a button click on a form)..."

Let's say we have this in a "body" of an aspx page:

<form runat="server">
<h3><asp:labe l id="lbl1" runat="server" /></h3>
<asp:button text="Submit" onclick="submit " runat="server" />
</form>

What does it mean by "the page is posted back to the server"? What's exactly
posted back here in the above example?

Thanks in advance!
Nov 17 '05 #1
5 2555
First of all the onclick attribute in an asp:button components must a
method in your code-behind.

Postback is generated every time you raise an event from a server-side
control. Thus when you click the "asp:button " text the page will be
posted-back.
Hope this helped ...

Nov 17 '05 #2
nly
Tasos Vogiatzoglou <tv*****@gmail. com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
First of all the onclick attribute in an asp:button components must a
method in your code-behind.

Postback is generated every time you raise an event from a server-side
control. Thus when you click the "asp:button " text the page will be
posted-back.

What does it mean by "the page ...(is)...poste d-back"?
Nov 17 '05 #3
It means the page posts back to itself. By default all web forms use
method="post" in the form of the page.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee. com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
"nly" <nl*******@yaho o.com> wrote in message
news:eU******** ******@TK2MSFTN GP12.phx.gbl...
Tasos Vogiatzoglou <tv*****@gmail. com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
First of all the onclick attribute in an asp:button components must a
method in your code-behind.

Postback is generated every time you raise an event from a server-side
control. Thus when you click the "asp:button " text the page will be
posted-back.

What does it mean by "the page ...(is)...poste d-back"?

Nov 17 '05 #4
nly,

Have a look at your HTML forms part of your page.

That information is posted back if you click on a control that has
autosentback set to true. Autosentback is default by some controls as the
button, however default false by some as by instance the listbox.

If it is "sentback", than everytime the data can be processed. The
IsPostBack is most often placed in the load event of the page in the code
behind.

By instance

if (IsPostBack) {
//Get Information From Database
}
else{
//Get information from Session item
}

I hope this helps,

Cor
Nov 17 '05 #5
Oeps,

Typed it here in the message

if (IsPostBack) {
//Get Information From Session
}
else{
//Get information from DataBase
}

I use mostly the ! situation.

:-)

Cor
Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1970
by: Tim | last post by:
I have dropdown list in Login page. The data is adding twice because the Page_Load event is executing twice. But I am checking !Page.IsPostBack property. First time the value for '!Page.IsPostBack' is 'true'. When it goes for second time it is not setting to 'false'. Please remember the '!' before the property. Which is means that still it is...
1
6334
by: Tim | last post by:
I have dropdown list in Login page. The data is adding twice because the Page_Load event is executing twice. But I am checking !Page.IsPostBack property. First time the value for '!Page.IsPostBack' is 'true'. When it goes for second time it is not setting to 'false'. Please remember the '!' before the property. Which is means that still it is...
2
14350
by: Pravin | last post by:
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.
6
16038
by: DotNetGruven | last post by:
I've got a page that does a search... There is an ImageButton on it that allows the user to reset the search. The Click Handler for the button clears out the Data and then redirects to the same page with Response.Redirect("Search.Aspx", true); Sometimes the code in Page_Load within the IsPostBack part of the if statement runs and...
14
1724
by: Mike | last post by:
I have a routine that i only want to execute if a variable is set to Y. The routine is getting some information on the screen then redirecting to a new page. How can i passed a variable to the Page.IsPostBack routine on the page_load event? this is what I'm trying to do/ sub page_load if page.ispostback then dim value as string =...
12
3105
by: Rudy | last post by:
Hi, I need to make a request to a asp.net page using HttpWebRequest class and I need to trick this page into thinking it's a postback and a button was clicked. But the page doesn't handle the click event, despite I'm using "POST" method and sending all the form fields (except of __VIEWSTATE, may this be the reason ?). So the question is:...
13
1500
by: tshad | last post by:
Is there a way to run a script or function on entry of each page without having to put a call in each page? Periodically, I find something I want to do each time a page is entered and I have to go into each page and add a line or 2 in my asp.net code. That's a lot of pages and I could easily miss one. For example, I have a user object...
1
2705
by: Ibrahim. | last post by:
Hi, I have a login page, the problem I'm facing is like this; 1. Login page with submit button (being default button); 2. When first time the page is submitted then submit code is called. 3. Again when page refresh is done by (f5) then submit button is fired implicitly.
0
862
by: Cameron Eckman | last post by:
I have a ASP.NET page in a site running in 1.1 framework. The page takes submissions of forms from other sites on the same server to prepopulate some of the items in it. If the posting site is ASP or ASP.NET 1.1, the IsPostBack property is false when the 1.1 page is first loaded. If the posting site is ASP.NET 2.0, the IsPostBack property...
0
7895
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8327
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7935
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5374
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3818
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3843
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.