Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 2nd, 2011, 08:08 AM
Registered User
Join Date: Dec 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default ICallbackEventHandler and Master Page


I'm trying to add a callback to my page which was created from a master page.
Unfortunatly, I always get an error:
"The target 'XXXPage' for the callback could not be found or did not implement ICallbackEventHandler."

When I tried it in a page which was not created from a master page everything works fine, as well as controls which implement ICallbackEventHandler and are located in the XXXPage.

Does anyone know what is the problem?

Old March 2nd, 2011, 05:08 PM
Authorized User
Join Date: Jan 2011
Posts: 86
Thanks: 1
Thanked 12 Times in 12 Posts

Did you perhaps implement the ICallbackEventHandler in the master page and try to register the client script in the content page?
Then you would need to specify it to register in the master page:
Master.Page.ClientScript.GetCallbackEventReference (...);
Master.Page.ClientScript.RegisterClientScriptBlock ....);
Old March 3rd, 2011, 07:00 AM
Registered User
Join Date: Dec 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

The problem was in the content page.
I solved it with a workaround:
The page was in an inner folder so the type of the page was innerFolder_XXXPage but the
GetCallbackEventReference function returned 'XXXPage' as the first parameter to the callback.

When the Page.ProcessRequestMain check if the request is a callback, it does not find a control with such name so it raise an exception.

To solve it, I override the FindControl method in the page:
public override Control FindControl(string id)
 Control ctl = base.FindControl(id);
 if (IsCallback && ctl == null && id == this.Page.GetType().BaseType.FullName)
    return this;
 return ctl;

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting the Master page hoses site... Page 92... richv BOOK: Beginning SharePoint 2010 Development 19 December 30th, 2010 10:21 AM
ICallbackEventHandler Interface ilegend .NET Framework 2.0 2 August 25th, 2008 10:56 PM
Master Page Method: Code-Behind for Content Page kwilliams ASP.NET 2.0 Professional 3 June 2nd, 2008 12:57 PM
Master Page and Content Page with Java script Harjinder ASP.NET 2.0 Professional 1 February 1st, 2008 10:31 AM
Access Master page control from Content page. angshujit ASP.NET 2.0 Basics 3 January 11th, 2007 06:20 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.