I just upgraded a hosted control to .NET 2.0 and I had to enable the ComVisible to access methods from the client side using javascript.
Should events also be accessible once I enable ComVisible? I was handling my events like this before with no issues:
<OBJECT id="foo" ...></OBJECT>
<script language="javascript">
function document.all.foo::SampleEvent(res){
//do stuff here
}
</script>
This won’t work either:
<script language="javascript" for="foo" event="SampleEvent(res)">
alert(res);
</script>
For some reason I can’t catch my events now. If I use my DLL in a WinForms project the event handles fine so I know I’ve set it all up properly.
How can I expose this to the client side properly?
Thanks
Just following up on this in case someone runs into it in the future. I had 2 mismatched data types in the user control which was causing the event not to fire properly.
Check your data types!