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
?