Attaching non-void events to a server control - is it possible ?

H

harel.moshe

Hey everybody,

I'm looking for a way to attach non-void events to a server control i
wrote.
Relevant code parts:


the control:


mycontrol : WebControl
{
public delegate string myEventHandler(string s);
public event myEventHandler OnClick;
...
...



}


the .aspx page portion:

<%
string func1(string s)
{
return s.Revers();
}
%>
<cc1:myContorl OnClick="func1" />


Now, what i want to do is to attach the click event of the control to a

function which returns a string, contrary to 'plain' events of .net
which are of void type and get 'sender' and 'e' as event-arguments.


The error i get is a compilation-time error saying 'func1' cannot be
converted from string type to a delegate. If so, i guess i have to
write a type converter which converts the function name to a delegate
that will invoke it. Is it the only way ? am i trying to do an
impossible thing while trying to attach a non-void function to an event

?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,016
Latest member
TatianaCha

Latest Threads

Top