473,569 Members | 3,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Order Events are fired and change at runtime.

I am trying to figure out how to handle a couple of problem using multiple
events tied to the same button.

Following is the button:

<asp:button ID="submitAnswe r" CommandName="Su bmitAnswer" runat="server"
style="color:#F F0000" Text="Submit Answer" OnClick="submit Answer_click"
onInit="submitA nswer_onInit" OnLoad="submitA nswer_onLoad"
OnPreRender="su bmitAnswer_onPr eRender" OnUnload="submi tAnswer_onUnloa d"
oncommand="subm itAnswer_onComm and"/>

Following is the trace with a trace.warn in each event.

aspx.page Begin Init
aspx.page End Init
aspx.page Begin LoadViewState
Inside submitAnswer_on Init sender = System.Web.UI.W ebControls.Butt on
Inside submitAnswer_on Init sender = System.Web.UI.W ebControls.Butt on
Inside submitAnswer_on Init sender = System.Web.UI.W ebControls.Butt on
Inside submitAnswer_on Init sender = System.Web.UI.W ebControls.Butt on
Inside submitAnswer_on Init sender = System.Web.UI.W ebControls.Butt on
Inside submitAnswer_on Init sender = System.Web.UI.W ebControls.Butt on
Inside submitAnswer_on Init sender = System.Web.UI.W ebControls.Butt on
Inside submitAnswer_on Init sender = System.Web.UI.W ebControls.Butt on
aspx.page End LoadViewState
aspx.page Begin ProcessPostData
aspx.page End ProcessPostData
Inside submitAnswer_on Load
Inside submitAnswer_on Load
Inside submitAnswer_on Load
Inside submitAnswer_on Load
Inside submitAnswer_on Load
Inside submitAnswer_on Load
Inside submitAnswer_on Load
Inside submitAnswer_on Load
aspx.page Begin ProcessPostData Second Try
aspx.page End ProcessPostData Second Try
aspx.page Begin Raise ChangedEvents
aspx.page End Raise ChangedEvents
aspx.page Begin Raise PostBackEvent
inside SubmitAnswer_cl ick
Inside submitAnswer_on Command
aspx.page End Raise PostBackEvent
aspx.page Begin PreRender 0.012925
Inside submitAnswer_on PreRender
aspx.page End PreRender
aspx.page Begin SaveViewState
aspx.page End SaveViewState
aspx.page Begin Render
aspx.page End Render

Why does the OnInit and OnLoad fire fire 8 times each?

Why is there no onUnload firing?

I tried in my onInit, onLoad and onClick event to turn off my onPreRender
event using :

Sender.Attribut es.Add("onPreRe nder", "")

But it still fires.

I also tried to add an event from the onInit event of the button like so:

Sender.Attribut es.Add("onPreRe nder", "submitAnswer_P reRender")

But it didn't fire.

I assume this is because all the events are collected when the button is
pushed, so changing it from runtime wouldn't help.

Tom
Nov 19 '05 #1
0 1210

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

Similar topics

1
3233
by: Jay Douglas | last post by:
Hello, This may be an elementary question, but I'm having a hard time finding a document that answers this question: What order are the events fired on classes / controls inherited from the System.Windows.Forms.Control class as the control is being created? i.e. does ControlAdded() get fired before Paint()? I good overview event document...
1
1603
by: John Martin | last post by:
I've made an .NET application where the contents of a datagrid (dgr1) is changed when the user changes the selection in a drop-down list (drd1). This has works fine as a beginning. Then I want to manipulate the look of the datagrid. I do this in the ItemCreated event, and on the first run (application start) this works as supposed. But when a...
5
2025
by: Q. John Chen | last post by:
On a webForm, I have a DropDownList with AutoPostBack=true and I also have couple textbox with AutoPostBack=false. I am expect that the DropDownList's SelectedIndexChanged event being handled after the textboxs' TextChanged event since this is the one that cause the PostBack. But I got the DropDownList's event first. Reading the...
7
3449
by: Dan Nash | last post by:
Hi guys Ok, i have an aspx with a user control. In the user controls pageload i set a property (mystring = "test";). i then want to access that from the page_load of the aspx thats using the control. the problem is that the pageload for the page fires before the pageload for the control, so if i say in my pageload ...
8
2607
by: Frank van Vugt | last post by:
Hi, If during a transaction a number of deferred triggers are fired, what will be their execution order upon the commit? Will they be executed in order of firing or alfabetically or something entirely different? The docs only mention regular triggers being executed alfabetically.
30
3619
by: Burkhard | last post by:
Hi, I am new to C# (with long year experience in C++) and I am a bit confused by the language construct of events. What is it I can do with events that I cannot do with delegates? At the moment it seems to me that Microsoft has developed similar functionality via two keywords. I do understand that an event offers better encapsulation as the...
3
1633
by: Mendoza | last post by:
I've got a simple web form with one text box and one button to search a database. II've suddenly encountered a problem where it seems the postback events are not fired. So when I click the button to search, the page simply refreshes as if I'm loading the page for the first time and the value in the textbox is also gone. I know the page_load...
7
1919
by: nick.fletcher | last post by:
I have a custom collection which derives from Collection<which stores a number of objects. Before each item is added to the collection - an event which it exposes is hooked by the collection and the re-fired to its parent. eg class MyCollection : Collection<MyType> { public AddAnObject(MyType obj)
1
1719
by: Klaus Jensen | last post by:
Subject: Handling events of controls created at runtime I need to render some buttons at runtime based on a database, tie events to them, and handle the events when they fire. In Page_Load I create the controls (for example a delete-button), add them to a placeholder, add eventhandlers, and the controls are displayed as expected. I...
0
7703
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...
0
7619
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...
0
7930
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. ...
0
7983
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...
0
5228
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3662
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...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
950
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...

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.