views:

505

answers:

1

Hi and thanks for reading.

I am using the ICallbackEventHandler interface to do some client-side processing in an ASP.Net page (VS 2005). Everything works as expected except under the following situation. I created a User Control (.ascx) that also uses ICallbackEventHandler and placed it on the aforementioned ASP.Net page. Now, the RaiseCallbackEvent fires on the User Control but not on the ASP.Net page. In other words, it doesn't fire in both places. Has anyone else encountered this and have a solution?

To reproduce, just create an ASP.Net page that uses ICallbackEventHandler, a User Control that uses ICallbackEventHandler and place it on the ASP.Net page and you'll see that the RaiseCallbackEvent fires in the User Control but not in the ASP.Net page.

Thanks!

A: 

When the ICallback event fires you'll need to raise your own event on the control so the page can be notified. The other option is implement an interface on your page and require that the user control is hosted on a page that implements the interface. Once you've done the latter you can cast your page as the interface and gain access to the interface properties and methods.

Thanks Anonymous!
OneSource