473,399 Members | 2,774 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,399 software developers and data experts.

Page_Load event firing twice... wierd!!

I've been fighting with the Page_Load event firing twice.
I looked through this user group and saw several other people having
similar problems.
There were various reasons for it:
AutoEventWireup="true" instead of AutoEventWireup="false"
Spyware software
And having your events all wired wrong

I had done everything to my machine, stripped it down to just have
..NET on it and I was still having this problem until...

I changed the page name.
That's right, I changed the page name from default.aspx to index.aspx.
It doesn't happen any more.
I'm not for sure why, but when I would create a default.aspx, VS.NET
would give it a code behind page with a class name of _Default.
Even when I changed the page name to index.aspx, I still had the
default.aspx page in the directory. After the Page_Load event would
fire in index.aspx it would also fire in default.aspx even though I
wasn't hitting that page.
VERY WIERD!!!!!
So noone has to go through the trial/error I had to go through, try
this if you are having the same trouble.
If anyone can explain this phenomenon to me, I would greatly
appreciate it!
Nov 18 '05 #1
7 2325
Shane,

Can you post your code ?

--
Regards,

HD
Once a Geek.... Always a Geek
"Shane Bishop" <s_********@yahoo.com> wrote in message
news:d0**************************@posting.google.c om...
I've been fighting with the Page_Load event firing twice.
I looked through this user group and saw several other people having
similar problems.
There were various reasons for it:
AutoEventWireup="true" instead of AutoEventWireup="false"
Spyware software
And having your events all wired wrong

I had done everything to my machine, stripped it down to just have
.NET on it and I was still having this problem until...

I changed the page name.
That's right, I changed the page name from default.aspx to index.aspx.
It doesn't happen any more.
I'm not for sure why, but when I would create a default.aspx, VS.NET
would give it a code behind page with a class name of _Default.
Even when I changed the page name to index.aspx, I still had the
default.aspx page in the directory. After the Page_Load event would
fire in index.aspx it would also fire in default.aspx even though I
wasn't hitting that page.
VERY WIERD!!!!!
So noone has to go through the trial/error I had to go through, try
this if you are having the same trouble.
If anyone can explain this phenomenon to me, I would greatly
appreciate it!

Nov 18 '05 #2
I haven't been able to reproduce this problem again. I think that it
was either a codebehind type-o or something of that nature.

It was so wierd, until I deleted that default.aspx page, no matter what
page I called in that same directory, the default.aspx's pageload event
got called.

Once I deleted the default.aspx page and everything worked fine. As
soon as I added a brand new default.aspx the same thing continued to
happen again. I've been trying to get it to happen again, and I haven't
been able to.

Thanks for your quick reply!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
Are there more than 1 default.aspx files in the project?
Thanks,
Shawn

"Shovem" <ca***********@nowhere.com> wrote in message
news:ey**************@TK2MSFTNGP11.phx.gbl...
I haven't been able to reproduce this problem again. I think that it
was either a codebehind type-o or something of that nature.

It was so wierd, until I deleted that default.aspx page, no matter what
page I called in that same directory, the default.aspx's pageload event
got called.

Once I deleted the default.aspx page and everything worked fine. As
soon as I added a brand new default.aspx the same thing continued to
happen again. I've been trying to get it to happen again, and I haven't
been able to.

Thanks for your quick reply!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #4
Ok. Nice to know I am not alone in this...

I have been trying to figure out this "posting twice" thing for 2 days.
I pushed the .Net code to my home, and the problem doesn't happen.

I load a page, enter/edit data, post. Everything posts to the db fine
and the code to redirect to another page is processed... but then the
[posted] page hits its Page_Load method again !! This time, when it
tries to write to the db (Page.IsPostBack is still true), the page's
timestamp doesn't match the db's timestamp so my error routine kicks in.

I added another WebPage to my project, copied the code from the "bad"
page to the new page, and everything runs as it did in the original...
posting twice.

Again, this very same code runs at my house (same environment) just
fine!!!

Any ideas? Please???

Environment at work and at home:
Windows XP Pro, IIS 5, .Net 2003 (C#), IE 6.

Thank you.

-- Wayne
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #5
... and another thing. The "posting twice" issue only happens when I
make a change to a text field on the form. I can change selected combo
fields all day long and post successully (once!).

If I add 'TextMode="MultiLine" Rows="0"' to the asp:textbox then the
page will post successfully (once), also.

I am baffled.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #6
It happens in my application too. That is, for SOME pages, typically
pages that display a PDF file (generated by Crystal Reports). I have
AutoEventWireup="false" on all pages. Other pages work fine.
Actually, it's not only the Page_Load; the object on the CodeBehind page
is instantiated twice (the constructor is called twice).

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #7
I found this on Google:
Microsoft .NET Framework 1.1 Page_Load Event Fires Two Times

http://support.microsoft.com/default...b;EN-US;827801

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #8

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

Similar topics

7
by: | last post by:
Hello to all I'm handling the Validating event for one text box. If something is wrong in user input I show a warning message. The problem is that if I add to method the message is displayed...
0
by: Oz | last post by:
Hi Using VS.NET 2003, Windows XP SP1, We have a page which has been developed using ASP.NET. On it, is a button which when clicked is supposed to add some data to a table. When the button is...
4
by: Larry Morris | last post by:
The following code, pasted into a web form with a link button on it, will cause the page_unload event to fire twice. If I remove the response.redirect, the problem goes away :). I've got a work...
4
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques...
4
by: C M Shaw | last post by:
I have a form which I want to show modally; it's a fairly old form that's been ported up several versions of VB, and I'd like to keep its rewriting to a minimum. Basically, it is used in this...
2
by: ann | last post by:
I have a datagrid control I am using - the edit & update events are firing twice. I searched on google and see others have had same issue not just with datagrid but with other controls, but no...
2
by: Slim | last post by:
I have loop that builds table rows, it also attaches events, this works fine on all but the last row, where the event fires twice I have autowireup set to false any ideas? For i = 0 To...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
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...

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.