473,698 Members | 2,086 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Event fires repeatedly

I have an event that occurs within a user control. The event is for a
dropdownlist within the user control which fires when the selected item
changes. This user control is created dynamicaly inside another user
control. There are other user controls created within the same
container control, however once the problem control event fires once it
fires again whith any other event fired on the page. Any ideas???

Oct 5 '06 #1
3 1469
Events are multi-cast delegates. This means that an event delegate may have
any number of event handler methods assigned to it. I am suspecting that
somehow you are re-assigning the event handler to the event accidentally.
How and when do you assign the event handler, and how often do you assign it
in the course of the application?

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

If the Truth hurts, wear it.

"Drex10" <dk*****@yahoo. co.ukwrote in message
news:11******** **************@ k70g2000cwa.goo glegroups.com.. .
>I have an event that occurs within a user control. The event is for a
dropdownlist within the user control which fires when the selected item
changes. This user control is created dynamicaly inside another user
control. There are other user controls created within the same
container control, however once the problem control event fires once it
fires again whith any other event fired on the page. Any ideas???

Oct 5 '06 #2
Sorry, I just realized that this was an ASP.Net question (I visit a number
of groups). The delegate aspect of my answer is therefore irrelevant.
However, I do suspect that you are somehow re-assigning the event handler,
so if you can provide some information about how and when you are assigning
the event handler, that will help.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

If the Truth hurts, wear it.

"Drex10" <dk*****@yahoo. co.ukwrote in message
news:11******** **************@ k70g2000cwa.goo glegroups.com.. .
>I have an event that occurs within a user control. The event is for a
dropdownlist within the user control which fires when the selected item
changes. This user control is created dynamicaly inside another user
control. There are other user controls created within the same
container control, however once the problem control event fires once it
fires again whith any other event fired on the page. Any ideas???

Oct 5 '06 #3
"Drex10" <dk*****@yahoo. co.ukwrote in message
news:11******** **************@ k70g2000cwa.goo glegroups.com.. .
>I have an event that occurs within a user control. The event is for a
dropdownlist within the user control which fires when the selected item
changes. This user control is created dynamicaly inside another user
control. There are other user controls created within the same
container control, however once the problem control event fires once it
fires again whith any other event fired on the page. Any ideas???
Yup! If it isn't an actual bug, then it's a feature that I don't
understand... :-) Microsoft refuse to acknowledge that it even happens, but
it so clearly does...

I don't know what causes it - I can't discern any pattern to it - however,
there is thankfully a very easy (though horrible!) workaround...

<asp:DropDownLi st ID="MyDDL" Runat="server"
OnSelectedIndex Changed="MyDDL_ SelectedIndexCh anged" AutoPostBack="t rue">

public void MyDDL_SelectedI ndexChanged(obj ect sender, EventArgs e)
{
if (Request.Form["__EVENTTAR GET"] == MyDDL.ClientID)
{
// actual code goes here
}
}
Oct 5 '06 #4

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

Similar topics

6
5327
by: Tom | last post by:
Hi, In the following code I have reproduced a problem in IE that is extremely annoying for my application. <html> <head> <script type="text/javascript">
5
3785
by: Maxine G | last post by:
I have two forms, a menu and a data entry form. The entry form is bound to a query against linked SQL server tables. In the deactivate event, I have some code which asks the user if they want to save their changes and they can respond with yes, no or cancel. If they press cancel, the entry form stays active with the changes still entered. So, if I'm on the entry form and have entered data, and then click on the menu, the deactivate event...
19
3483
by: Heidi Hundåla | last post by:
Hi ! I have a Wep App in C#. Page_Unload fires after Page_Load, and it seems totally unreasonable when you want to use this event when you _leave_ the page. In my project we wanted to use the Page_Unload - event to clean up the Session variables, but when it turns out that it fires before the end, it screws up the code, and
0
435
by: ChrisB | last post by:
I'm attempting to open a new window from a LinkButton in a DataGrid. I can set a session variable in the ItemCommand event for the LinkButton like so: // this is used to handle the ItemCommand event private void itmCmd(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { string itemGFNo = ""; if (e.CommandName == "EditTask")
0
1598
by: Mark | last post by:
There appear to be several ways to get the global error handler in global.asax.cs to fire repeatedly in a nasty endless loop. Is there a way to keep this event from firing only a handful of times over the course of a minute, so that if it's obviously caught in a vicious loop, it will stop? In our global error handler, we send an email warning developer's of the problem. However, if the global error handler fires repeatedly, we get...
8
1792
by: Paul | last post by:
Hi, In a class i built, i fire an event when a field changes. In a webform that has an instance of the class, the event (from the class) is fired and the code is executed. However, my webpage does not reload (postback) after the event fires. How do i get the webform to postback when the event fires (after the code in the event is done executing)? Thank you, Paul
2
2549
by: AMDRIT | last post by:
Hello Everyone, I am having an issue where an event appears to be fired repeatedly where I only expect it to be fired once. See below for objects and behaviors. I have a control that contains a treeview, it creates the TopLevel object and subscribes to the ObjectChanged Event. When the event is fired, I rebuild the treeview. If I change data from TopLevelData, the event is fired just once. When I change data in ChildObject, the...
1
5358
by: Jeremy Martin | last post by:
Hi, I am currently learning c# so be gentle :) I am converting a Delphi.NET website to c# website and I am confused as to how events are handled. 2 Situations. 1. A component on a webusercontrol fires a postback event. On postback
6
1302
by: kirk | last post by:
I have three events, using event handler methods as depicted below. Two of those event handler methods need to reset specific data whenever the other event left fires. I wasn't sure how to properly implement that, is there a better way than using state management variables for each timer as i'm doing in the outline below? private string szProperty1 = null; // updated by class consumer
0
9157
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
8895
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
8861
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
5860
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4369
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
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
2
2330
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
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.