469,644 Members | 1,781 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,644 developers. It's quick & easy.

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 4814
> 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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jensen Hoh | last post: by
8 posts views Thread by moondaddy | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.