473,396 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Load event behavior

Hello,

I just don't get it. I have a simple webform1.aspx page, when loaded
for the first time, the load even fires which is fine.

In webform1.aspx i have a button that has a onclick event, and in this
event i do a response.redirect to webform2.aspx page. However on the
onclick event of the button, the Load event for webform1.aspx is
loaded again! Then the redirection is done!

And that's not all: once we are in webform2.aspx, if i do a
response.redirect to webform1.aspx, the load event in webform1.aspx
fires twice!

Could please someone explain me this weird behavior please? Thanks
Nov 17 '05 #1
3 3298
Matt

"Matt" <me***@rocks.com> wrote in message
news:md********************************@4ax.com...
Hello,

I just don't get it. I have a simple webform1.aspx page, when loaded
for the first time, the load even fires which is fine.

In webform1.aspx i have a button that has a onclick event, and in this
event i do a response.redirect to webform2.aspx page. However on the
onclick event of the button, the Load event for webform1.aspx is
loaded again! Then the redirection is done!

And that's not all: once we are in webform2.aspx, if i do a
response.redirect to webform1.aspx, the load event in webform1.aspx
fires twice!

Could please someone explain me this weird behavior please? Thanks


Use IsPostBack in the Load event to determine if it is a post back or not.
Load will run every time the

private void Page_Load(object sender, System.EventArgs e) {
if (IsPostBack) {
// This would be run if the page is posted back like in your situation
// Do some code
} else {
// this would be executed the first time the page is loaded
// do some other code
}

Kevin Bilbee
Nov 17 '05 #2
If you don't want the load event to fire why are you redirecting at all ?
You could just go directly to webform2 via a hyperlink or some client side
JS behind the button. That will save asp.net from having to fire up webform1
when it isn't really needed.
Damian


"Matt" <me***@rocks.com> wrote in message
news:md********************************@4ax.com...
Hello,

I just don't get it. I have a simple webform1.aspx page, when loaded
for the first time, the load even fires which is fine.

In webform1.aspx i have a button that has a onclick event, and in this
event i do a response.redirect to webform2.aspx page. However on the
onclick event of the button, the Load event for webform1.aspx is
loaded again! Then the redirection is done!

And that's not all: once we are in webform2.aspx, if i do a
response.redirect to webform1.aspx, the load event in webform1.aspx
fires twice!

Could please someone explain me this weird behavior please? Thanks

Nov 17 '05 #3
Hi,

Could you send sample code ? I try to create this senario on machine
without any luck.

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #4

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

Similar topics

0
by: ptass | last post by:
I have a main form (Form1) which opens a second form (Form2) when a button is clicked. Form2 has .FormBorderStyle set to FixedSingle. Form2 contains two buttons, one which unpins it from Form1...
3
by: feng | last post by:
We have a windows form project that has multiple child forms inherit from one base form. In our base form's form load event handler, we have some common logic in there. These common logic is...
0
by: Isz | last post by:
PROBLEM: This problem is related to the postback and handling events correctly. BACKGROUND: I have a datalist which acts as a tabbes list with horizontal layout. This datalist is bound to a...
4
by: Ravi Ambros Wallau | last post by:
Hi: We developed a set of ASP.NET Web Applications that never runs in stand-alone mode, but always inside a portal (Rainbow Portal). All modules are copied on that portal. My question is: load...
3
by: Mike Dee | last post by:
Hi, I'm having an issue with the status bar in Mozilla and Netscape showing that it is still waiting on the page to load even after it is finished. This problem does NOT occur with IE. In...
1
by: Jason Richmeier | last post by:
I am experiencing some unexpected behavior with the Form Load event in a Windows application. Hopefully, someone can explain why this behavior is occurring. In my application, I have a form...
6
by: Rolandpish | last post by:
Hi there. I'm doing an application in C# 2005. I was used in VB6 to put code in Forms load event in order to initialize some values of the controls (grid values, text boxes values, label captions,...
0
by: manywolf | last post by:
I have an aspx page that fires the page load event twice for every load. I tried every fix that was suggested in all the posts on this and other forums. None changed the behavior. After one post that...
2
by: ZBINContact | last post by:
I am creating a self-checking set of usercontrols. They tend to call their self-checking functionally in the "Load" event. I have run into a problem with my TextBox usercontrol, however, as the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
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...

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.