473,785 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Load Event is Raised Twice

Hi

Can anyone explain why the Load Even is raised twice in the web page?

What can be done to avoid it?

Thanks,
Samuel
Jan 22 '07 #1
4 1268
Do you have both automatic event wire-up and explicit server event setting?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Samuel Shulman" <sa************ @ntlworld.comwr ote in message
news:O%******** ********@TK2MSF TNGP06.phx.gbl. ..
Hi

Can anyone explain why the Load Even is raised twice in the web page?

What can be done to avoid it?

Thanks,
Samuel

Jan 22 '07 #2
Not sure, where would I set these settings?
"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:eA******** ******@TK2MSFTN GP05.phx.gbl...
Do you have both automatic event wire-up and explicit server event
setting?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Samuel Shulman" <sa************ @ntlworld.comwr ote in message
news:O%******** ********@TK2MSF TNGP06.phx.gbl. ..
>Hi

Can anyone explain why the Load Even is raised twice in the web page?

What can be done to avoid it?

Thanks,
Samuel


Jan 22 '07 #3
AutoEventWireup is an attribute in @Page directive. Default value is true.
It wires the server controls to event handling methods with matching names
and signatures. For example, if you have a Page_Load method like this

protected void Page_Load(objec t sender, EventArgs e)

in the code-behind and AutoEventWireup is true, the method will run as the
Page Load event handler.

If you also setup the events yourself with something like

Load += new EventHandler(Pa ge_Load);

or in any other way, the event will be called twice.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Samuel Shulman" <sa************ @ntlworld.comwr ote in message
news:eb******** ******@TK2MSFTN GP06.phx.gbl...
Not sure, where would I set these settings?
"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:eA******** ******@TK2MSFTN GP05.phx.gbl...
>Do you have both automatic event wire-up and explicit server event
setting?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Samuel Shulman" <sa************ @ntlworld.comwr ote in message
news:O%******* *********@TK2MS FTNGP06.phx.gbl ...
>>Hi

Can anyone explain why the Load Even is raised twice in the web page?

What can be done to avoid it?

Thanks,
Samuel



Jan 22 '07 #4
Thank you

I am working on an existing project and I will have to check that

Regards,
Samuel
"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:OJ******** ******@TK2MSFTN GP05.phx.gbl...
AutoEventWireup is an attribute in @Page directive. Default value is true.
It wires the server controls to event handling methods with matching names
and signatures. For example, if you have a Page_Load method like this

protected void Page_Load(objec t sender, EventArgs e)

in the code-behind and AutoEventWireup is true, the method will run as the
Page Load event handler.

If you also setup the events yourself with something like

Load += new EventHandler(Pa ge_Load);

or in any other way, the event will be called twice.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Samuel Shulman" <sa************ @ntlworld.comwr ote in message
news:eb******** ******@TK2MSFTN GP06.phx.gbl...
>Not sure, where would I set these settings?
"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:eA******** ******@TK2MSFTN GP05.phx.gbl...
>>Do you have both automatic event wire-up and explicit server event
setting?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Samuel Shulman" <sa************ @ntlworld.comwr ote in message
news:O%****** **********@TK2M SFTNGP06.phx.gb l...
Hi

Can anyone explain why the Load Even is raised twice in the web page?

What can be done to avoid it?

Thanks,
Samuel



Jan 22 '07 #5

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

Similar topics

1
2669
by: James Lennon | last post by:
Is there an event that is raised that occurrs after a Windows form is displayed for the firt time? The Load event occurrs before the form is displayed for the first time I am looking for an event that is raised after the form is displayed for the first time?
8
3361
by: MaryA | last post by:
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
4
2448
by: Kalvin | last post by:
I have seen this question raised, but I cannot find an answer. I have an MDI app, when I load an child form with a combobox being bound in the load event, it won't allow me to set selectedindex = -1. If it isn't an mdi child, then there isn't a problem. I have tried setting it to -1 two times. I have tried setting the selecteditem property to -1 and also to nothing. None of it seems to make a difference. Any help will be appreciated.
3
2738
by: Dennis | last post by:
I have the following code for showing a form: dim frm as new myForm frm.ShowDialog (The Form Load Event is fired then I hide the form using Me.Hide when the X in the UR corner is clicked). 'Do something in code frm.ShowDialog (The Form Load Event fires again)
1
2261
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 that I would like to show multiple times throughout the life of the application. The startup code for this form can be quite lengthy so I am hiding and showning the form (versus unloading and loading it). If I show the form non-modally (using the...
2
1900
by: Anup | last post by:
Hi Group, In my application I am using a datagrid, now I m implementing sorting for that datagrid, I am changing the flag for ascending and descending when SortCommand event of datagrid is fired. Now the problem I am facing is that the Sort Command event is being fired twice even if I click the header in datagrid only once thus my flag is getting reset to the original value.
0
1610
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 suggested they had an img tag with src="", I decided to look for instances of "src" and one by one start removing that code to see if it changed anything. Below is the one that, when I removed it, although it broke the flash menus and header, solved...
4
4516
by: chris.c.woodward | last post by:
This event seems to be being raised twice in my codebehind. I have only one SelectMethod and do not have a SelectCountMethod. Its causing a problem because I'm dynamically loading a user control into a PlaceHolder control in the method and am having to do a check to see if it already exists or not otherwise it gets loaded twice. Also it would be nice to figure out what the heck is going on! Here is the code ... protected void...
4
7247
by: tomb | last post by:
I'm using VB.net 2003 and a FileSystemWatcher. The Changed event gets called twice for every change in the folder I'm watching. To build the functionality, I'm manually changing a text file. As soon as I save the changed file, the event is called, which is great. But then the event is called again almost immediately. That causes some serious issues for my program. Has anyone seen this before? Is there a way to stop it? Thanks
0
9646
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9484
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10350
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10097
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9957
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8983
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5386
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2887
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.