473,473 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Page load vs. reload ?

Hi !

How do I distinguish a page reload event ( i mean a page_load due to
some clicks, etc. which dont cause a postback) from a page load event
( the first time the page loads) ??

Thanks !

Apr 13 '07 #1
2 9740
your answer is hidden in your question
There is a property that you can check to find that
and it is "IsPostback"

example code

protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
//This is a reload, also known as a post back and is caused by an
event on the same page
}
else
{
//This is first load as a result of first browser request or simply
clicking a link on a different page that brings you here or a redirect
}
}

On Apr 13, 7:24 am, "Zeba" <coolz...@gmail.comwrote:
Hi !

How do I distinguish a page reload event ( i mean a page_load due to
some clicks, etc. which dont cause a postback) from a page load event
( the first time the page loads) ??

Thanks !

Apr 13 '07 #2
Hi Kareem,
Thank you, but I was actually looking for something to detect the page
reload when it isn't a post back .. such as when Ajax calls are used.
I finally set a hidden variable in the aspx page (default value null)
and set it to some value in the code behind. So the first time, the
hidden variable is null, but on all subsequent reloads ( which dont
involve refresh) it will be null.

Thanks !

On Apr 13, 6:13 pm, "Karim" <jimmy00...@gmail.comwrote:
your answer is hidden in your question
There is a property that you can check to find that
and it is "IsPostback"

example code

protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
//This is a reload, also known as a post back and is caused by an
event on the same page
}
else
{
//This is first load as a result of first browser request or simply
clicking a link on a different page that brings you here or a redirect
}

}
Apr 14 '07 #3

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

Similar topics

10
by: riversmithco | last post by:
This should be easy, How do I reload a page so that it makes the server think it's the first time the page has been loaded? Thanks
8
by: Salvatore Sanfilippo | last post by:
Hello all, I've a very simple problem that appears to don't have a simple solution. I've a (dynamically generated) page with a number of external links. What I need is that if the user clicks...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
7
by: Schmidty | last post by:
Okay...I have another 'newbie' question; I have a function that loads a page and the action is $_SERVER; In the form that is in a function(method?) within a class a variable is passed back to...
2
by: ramanaths | last post by:
Hi I have a page that shows many thumbnail images. on load of this page i have some code that invokes a javascript which shows a message saying 'loading images'... this is hidden once all the...
5
by: =?Utf-8?B?Sm9obg==?= | last post by:
Hi, I used the following code to refresh the parent page, and it works very well (Thanks to Peter Bromberg "). Response.Write("<script language='javascript' type='text/javascript'{...
7
by: amishguy | last post by:
Hello, I am having an issue with a site I'm creating right now. I have had this issue before and I would like to figure out what the solution is instead of using workarounds as I have in the...
2
by: ericisjusteric | last post by:
I have a page with multiple iframes and need to have the user (ie6) be able to click a button to refresh any one of the iframes - but also to click another button at the top of the page to refresh...
2
by: RobertTheProgrammer | last post by:
Okay, here's another one for you. Hopefully I can articulate my problem well enough... I've got a GridView (with C# code behind) that is having some page load issues. Users can enter and...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.