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

cannot remove event handler on control

I have a control defined:
<asp:AccessDataSource ID="ADS1" OnUpdated="ADS_OnUpdated" [...]>
and in code behind:

protected void OnUpdated(object sender, SqlDataSourceStatusEventArgs e)
{
ADS1.Updated -= new System.EventHandler(AD1_OnUpdated);
}

And this won't work: CS0123: No overload for 'AD1_OnUpdated' matches
delegate 'System.EventHandler'

Also, is there some way to just simply clear all event handlers for the
control?
Nov 17 '05 #1
1 5043
> protected void OnUpdated(object sender, SqlDataSourceStatusEventArgs
e)
{
ADS1.Updated -= new System.EventHandler(AD1_OnUpda*ted);
}

And this won't work: CS0123: No overload for 'AD1_OnUpdated' matches delegate 'System.EventHandler'

It won't work for exactly the reason that the message outlines: you
"new"ed the wrong thing. The event handler is not a
System.EventHandler. I'm guessing by the name of the argument to
OnUpdated that it's probably called a SqlDataSourceStatusEventHandler.
Try making one of those instead.
Also, is there some way to just simply clear all event handlers for

the control?

Yes. I believe that the syntax is

ADS1.Updated = null;

but I'm not sure.

Nov 17 '05 #2

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

Similar topics

8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
4
by: Torben | last post by:
For test purposes I attach an event to a control, say a TextBox TextChanged event. At another time the same event delegate is attached to some other control, maybe a listbox. Same event function...
1
by: sianan | last post by:
I tried to use the following example, to add a checkbox column to a DataGrid in an ASP.NET application: http://www.codeproject.com/aspnet/datagridcheckbox.asp For some reason, I simply CAN'T get...
9
by: Charles Law | last post by:
I have a form on which user controls are placed at runtime. When a control is added to the form a handler is added for an event that a high-level object raises, which must be handled by the new...
4
by: Charles Law | last post by:
Is there a way to dynamically remove an event handler from an event without knowing the name of the handler? For example, how can ClassB remove the handler without knowing the name, or how many...
2
by: Jensen Hoh | last post by:
How can I remove a event handle dynamically? I knew that, it is the proper way to add a event handler for a control Add Handler -----------------------------------------------...
8
by: wASP | last post by:
Hi, I'm having a problem referencing the elements within an object after a method of that object (a member function) has been activated with an onsubmit handler: - - - - - - - - ...
2
by: Kela | last post by:
An interesting problem: I have a ListView with LabelEdit set to TRUE. When I change the label, I want to make some decisions as to whether the ListViewItem (that's just been edited) should stay in...
8
by: moondaddy | last post by:
I'm working in WPF and c# and am adding an event handler to an object like this: this.tgt.SizeChanged += new SizeChangedEventHandler(OnTargetSizeChanged); Later I kill the instance of...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.