An ASP.NET Blog
I work for Microsoft and help people and businesses make better use of technolgy to realize their full potential. The opinions mentioned herein are solely mine and do not reflect those of my employer.

ASP.NET 2.0 - "The target '__Page' for the callback could not be found or did not implement ICallbackEventHandler" Error

Tuesday, January 10, 2006 12:44 PM
Client Script Call Back is one of the coolest features in ASP.NET 2.0. The idea of client side refresh in the data wherein the server side execution happens in Remote scripting is a huge leap towards the scalability of web applications. Remote scripting has been around for quite a while in different forms such as Remote Scripting Core, Ajax, Atlas, Client Script Call Back etc., They all have one basic advantage. In order to communicate with the Server, the page doesnt have to do a postback. This avoids the ugly flash and controls state retaining problem.

While implementing Client Script Call Back, you may receive the error "The target '__Page' for the callback could not be found or did not implement ICallbackEventHandler."

This error occurs, if you miss to specify the ICallBackEventHandler Interface in your Page Inheritance.

The typical Code behind class for an ASP.NET 2.0 Webform looks as below:-

public partial class _Default : System.Web.UI.Page

However, in the case of implementing Client Script Call Back, we also need to specify the Interface as follows:-

public partial class _Default : System.Web.UI.Page, ICallbackEventHandler

This specifies that the page implements ICallBackEventHandler interface and can implement client side scripting call backs to the server side code.

This setting might just be overlooked when we create the page since, the partial class declaration code is added by default and we always resort to start writing our code from the Page_Load event and other events and dont interfere with the auto generated code such as the class definition. The ICallbackEventHandler is not added by default. It has to be explicitly specified as mentioned above.

This would resolve your issue.

Cheers and Happy Programming !!!

Feedback

# re: ASP.NET 2.0 - "The target '__Page' for the callback could not be found or did not implement ICallbackEventHandler" Error

If vb.net means how can solve this error message 11/1/2006 11:42 AM | Lourdu Rajan

# re: ASP.NET 2.0 - "The target '__Page' for the callback could not be found or did not implement ICallbackEventHandler" Error

I spent 3 hours and half to find that I have to write only one word. Many thanks.
2/13/2007 9:53 AM | Adam

# re: ASP.NET 2.0 - "The target '__Page' for the callback could not be found or did not implement ICallbackEventHandler" Error

it does not work with a masterpage
i have an ajaxvalidator and it works fine but when in an masterpage i got this error

The target 'ctl00_contentplaceholder_ajaxvalidator' for the callback could not be found or did not implement ICallbackEventHandler

and there is a callbackhandler

it works fine without the masterpage 2/22/2007 8:59 PM | Waltz

# re: ASP.NET 2.0 - "The target '__Page' for the callback could not be found or did not implement ICallbackEventHandler" Error

its very useful for beginers. thanks for this article 5/13/2008 6:40 PM | Prasanna

# re: ASP.NET 2.0 - "The target '__Page' for the callback could not be found or did not implement ICallbackEventHandler" Error

Thanks Buddy! It worked. Hats off to you... 11/13/2008 4:13 PM | Sanket Sirotiya

Post a comment





 

Please add 2 and 1 and type the answer here: