473,385 Members | 1,848 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,385 software developers and data experts.

Page-load twice

I have an aspx page that loads twice inspite of using the IsPostBack
i removed all controls from the page and still the page_load event is called
twice
I appriciate any help coz i have lost several hours on this

NB even i removed all events called on page load but still same problem

Regards
Nov 19 '05 #1
8 3312
As far as I know the only thing which would cause the page to reload is a
either some Javascript in the OnLoad event for the page which is doing
something, or a META-EQUIV tag which forces the browser to reload.

HTH
"MaryA" <Ma***@discussions.microsoft.com> wrote in message
news:8A**********************************@microsof t.com...
I have an aspx page that loads twice inspite of using the IsPostBack
i removed all controls from the page and still the page_load event is
called
twice
I appriciate any help coz i have lost several hours on this

NB even i removed all events called on page load but still same problem

Regards

Nov 19 '05 #2
MaryA wrote:
I have an aspx page that loads twice inspite of using the IsPostBack
i removed all controls from the page and still the page_load event is
called twice
I appriciate any help coz i have lost several hours on this

NB even i removed all events called on page load but still same
problem

Regards


What language are you using?

do you have AutoEventWireup="false" in the @Page directive?
(this set to true is usually the reason Page_Load is called twice)

Hans Kesting
Nov 19 '05 #3
Thats interesting, Ive never come across this before , why is that Hans ?

Regards Mr N

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
MaryA wrote:
I have an aspx page that loads twice inspite of using the IsPostBack
i removed all controls from the page and still the page_load event is
called twice
I appriciate any help coz i have lost several hours on this

NB even i removed all events called on page load but still same
problem

Regards


What language are you using?

do you have AutoEventWireup="false" in the @Page directive?
(this set to true is usually the reason Page_Load is called twice)

Hans Kesting

Nov 19 '05 #4
Pages support an automatic way to bind their events to methods.

If the AutoEventWireup attribute of the @ Page directive is set to true
(or if it is missing, because by default it is true), page events are automatically
bound to methods that use the naming convention of Page_event,
such as Page_Load and Page_Init.

The AutoEventWireup attribute requires that the
page event handlers have specific, predictable names.

If you want to create your own names for page event handlers, you can set
AutoEventWireup to false and then bind the events to the methods explicitly.

For example, in Visual Basic, you can use the Handles keyword to perform the binding.

If you include explicit binding, you must make sure that the
AutoEventWireup is disabled so that the method is not called twice,
once automatically by AutoEventWireup and another time by
your explicit binding.


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================

"Mr Newbie" <he**@now.com> wrote in message news:eP**************@TK2MSFTNGP11.phx.gbl...
Thats interesting, Ive never come across this before , why is that Hans ?

Regards Mr N

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
MaryA wrote:
I have an aspx page that loads twice inspite of using the IsPostBack
i removed all controls from the page and still the page_load event is
called twice
I appriciate any help coz i have lost several hours on this

NB even i removed all events called on page load but still same
problem

Regards


What language are you using?

do you have AutoEventWireup="false" in the @Page directive?
(this set to true is usually the reason Page_Load is called twice)

Hans Kesting



Nov 19 '05 #5
Mr Newbie wrote:
Thats interesting, Ive never come across this before , why is that
Hans ?
Regards Mr N
AutoEventWireup=true (default!) will automatically hook Page_Load to the
Load event of the Page. When you also add it "by hand" (could be
done automatically for a C# codebehind) with a this.Load += ...,
then it is added a second time (and executed a second time).

from MSDN:
----
Alternatively, the ASP.NET page framework also supports an automatic way to associate page events and methods. If the
AutoEventWireup attribute of the Page directive is set to true (or if it is missing, since by default it is true), the page
framework calls page events automatically, specifically the Page_Init and Page_Load methods. In that case, no explicit Handles
clause or delegate is needed.

The disadvantage of the AutoEventWireup attribute is that it requires that the page event handlers have specific, predictable names.
This limits your flexibility in how you name your event handlers. Therefore, in Visual Studio, the AutoEventWireup attribute is set
to false by default and the designer generates explicit code to bind page events to methods.

If you do set AutoEventWireup to true, Visual Studio will generate code to bind the events and the page framework will automatically
call events based on their names. This can result in the same event code being called twice when the page runs. As a consequence,
you should always leave AutoEventWireup set to false when working in Visual Studio.

----

Hans Kesting


"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
MaryA wrote:
I have an aspx page that loads twice inspite of using the IsPostBack
i removed all controls from the page and still the page_load event
is called twice
I appriciate any help coz i have lost several hours on this

NB even i removed all events called on page load but still same
problem

Regards


What language are you using?

do you have AutoEventWireup="false" in the @Page directive?
(this set to true is usually the reason Page_Load is called twice)

Hans Kesting

Nov 19 '05 #6
Thanks for that explaination, I have never seen this set to true, so its an
eye opener for me.

Regards Mr N

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:ue*************@TK2MSFTNGP15.phx.gbl...
Mr Newbie wrote:
Thats interesting, Ive never come across this before , why is that
Hans ?
Regards Mr N


AutoEventWireup=true (default!) will automatically hook Page_Load to the
Load event of the Page. When you also add it "by hand" (could be
done automatically for a C# codebehind) with a this.Load += ...,
then it is added a second time (and executed a second time).

from MSDN:
----
Alternatively, the ASP.NET page framework also supports an automatic way
to associate page events and methods. If the AutoEventWireup attribute of
the Page directive is set to true (or if it is missing, since by default
it is true), the page framework calls page events automatically,
specifically the Page_Init and Page_Load methods. In that case, no
explicit Handles clause or delegate is needed.

The disadvantage of the AutoEventWireup attribute is that it requires that
the page event handlers have specific, predictable names. This limits your
flexibility in how you name your event handlers. Therefore, in Visual
Studio, the AutoEventWireup attribute is set to false by default and the
designer generates explicit code to bind page events to methods.

If you do set AutoEventWireup to true, Visual Studio will generate code to
bind the events and the page framework will automatically call events
based on their names. This can result in the same event code being called
twice when the page runs. As a consequence, you should always leave
AutoEventWireup set to false when working in Visual Studio.

----

Hans Kesting


"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
MaryA wrote:
I have an aspx page that loads twice inspite of using the IsPostBack
i removed all controls from the page and still the page_load event
is called twice
I appriciate any help coz i have lost several hours on this

NB even i removed all events called on page load but still same
problem

Regards

What language are you using?

do you have AutoEventWireup="false" in the @Page directive?
(this set to true is usually the reason Page_Load is called twice)

Hans Kesting


Nov 19 '05 #7
Thanks for that explaination, I have never seen this set to true, so its an
eye opener for me.

Regards Mr N
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:Oa**************@TK2MSFTNGP12.phx.gbl...
Pages support an automatic way to bind their events to methods.

If the AutoEventWireup attribute of the @ Page directive is set to true
(or if it is missing, because by default it is true), page events are
automatically
bound to methods that use the naming convention of Page_event,
such as Page_Load and Page_Init.

The AutoEventWireup attribute requires that the
page event handlers have specific, predictable names.

If you want to create your own names for page event handlers, you can set
AutoEventWireup to false and then bind the events to the methods
explicitly.

For example, in Visual Basic, you can use the Handles keyword to perform
the binding.

If you include explicit binding, you must make sure that the
AutoEventWireup is disabled so that the method is not called twice,
once automatically by AutoEventWireup and another time by
your explicit binding.


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================

"Mr Newbie" <he**@now.com> wrote in message
news:eP**************@TK2MSFTNGP11.phx.gbl...
Thats interesting, Ive never come across this before , why is that Hans ?

Regards Mr N

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
MaryA wrote:
I have an aspx page that loads twice inspite of using the IsPostBack
i removed all controls from the page and still the page_load event is
called twice
I appriciate any help coz i have lost several hours on this

NB even i removed all events called on page load but still same
problem

Regards

What language are you using?

do you have AutoEventWireup="false" in the @Page directive?
(this set to true is usually the reason Page_Load is called twice)

Hans Kesting



Nov 19 '05 #8
article here may help:

http://support.microsoft.com/default...b;EN-US;317690
---------------------------------------------------------------
Tax the churches so the poor can eat
Nov 19 '05 #9

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

Similar topics

1
by: Michael Brennan-White | last post by:
If I submit my for using a get action the resulting page loads . If I use a post action I get an error page saying "The page cannot be found". I am calling the originating page!!! This happens...
0
by: Nathan | last post by:
Hi, I seem to having a peculiar problem with the display of odd and even pages in XSL-FO. Here is a small background of the problem. My xsl stylesheet mentions my fo:layout-master-set as ...
1
by: Lenard Gunda | last post by:
Hi! I have the following problem. From my main page, when someone clicks a button, it uses client side javascript to open another .aspx page. This page displays content, based on what the...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
8
by: Ed Jay | last post by:
I want to use history.go() to navigate between my previously loaded pages. I'm looking for a way to trigger a function call when a page is accessed using history.go(). Is there an event generated?...
2
by: SR | last post by:
I have started a web site using ASP.NET 2.0. I would like to centralize all of my classes in a StyleSheet but I cannot figure out how to link the StyleSheet to a Content Page since there is no...
1
by: CaptainDahlin | last post by:
I know the basics about access reports and putting page totals in the page footers. What I can't figure out is along with the current page total to display the previous page total: At the bottom...
17
by: =?Utf-8?B?Y2F0aGFyaW51cyB2YW4gZGVyIHdlcmY=?= | last post by:
Hello, I have build a website with approximately 30 html-pages. When I search this website in Google, I see the index.html or home.html on this website, but also other html-pages on this...
4
by: evantay | last post by:
I'm using ASP.NET 2.0 with VS.NET 2005. I'm trying to access properties from my master pages within a page that inherits from that master page (a child page). However the values are always null....
3
by: Mesut | last post by:
I have written a form in with radio buttons the name is set to orderby and the value is set to KundeVorName and the next value is KundeNachName and it goes so on. I wanna modify my query according...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
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...

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.