Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 2nd, 2011, 08:08 AM
Registered User
Points: 14, Level: 1
Points: 14, Level: 1 Points: 14, Level: 1 Points: 14, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default ICallbackEventHandler and Master Page

Hi

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?

Thanks
Guy
  #2 (permalink)  
Old March 2nd, 2011, 05:08 PM
Authorized User
Points: 448, Level: 7
Points: 448, Level: 7 Points: 448, Level: 7 Points: 448, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 86
Thanks: 1
Thanked 12 Times in 12 Posts
Default

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 ....);
  #3 (permalink)  
Old March 3rd, 2011, 07:00 AM
Registered User
Points: 14, Level: 1
Points: 14, Level: 1 Points: 14, Level: 1 Points: 14, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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:
Code:
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;
}
Guy
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:18 AM.


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