Forums

Error: The target 'ASPxCallback1' for the callback could not be found or did not implement ICallbackEventHandler

Last post 2/25/2011 8:32 AM by Adrian Bordones. 6 replies.
Sort Posts: Previous Next
  • Thieme

    Error: The target 'ASPxCallback1' for the callback could not be found or did not implement ICallbackEventHandler

    6/14/2008 3:25 PM
    • Not Ranked
    • Joined on 3/20/2008
    • Posts 6

    Hi guys,

    I was wondering if it’s possible to load via a callback in ASPxPopupControl a usercontrols, which consist of some html and a callback.

    Now I get the error:
    eThe target 'ASPxCallback1' for the callback could not be found or did not implement ICallbackEventHandler
    (Error from Firebug of Firefox)


    My code is based of this example: http://demos.devexpress.com/Tutorials/SourceViewer.aspx?tutorial=ASPxperience/PopupControl/HowToLoadUserControlViaCallback/HowToLoadUserControlViaCallback

    I edit only the UserControl1.ascx to:


     <table cellpadding="0" cellspacing="0" style="width: 100%;">
         <tr>
             <td>
                 <dxe:ASPxLabel ID="ASPxLabel1" runat="server" Text="UserControl 1 has been loaded successfully">
                 </dxe:ASPxLabel>
             </td>
         </tr>
         <tr>
             <td style="padding-top: 10px;" align="center">
                 <dxe:ASPxButton ID="okButton1" runat="server" Text="Ok" AutoPostBack="false">
                     <ClientSideEvents Click="function(s, e) { callback.SendCallback(); } "/>
                 </dxe:ASPxButton>
             </td>
         </tr>
     </table>

    <dxcb:ASPxCallback ID="ASPxCallback1" runat="server"
        oncallback="ASPxCallback1_Callback" ClientInstanceName="callback">
    </dxcb:ASPxCallback>

     

    And in the code behind I added this:
            protected void ASPxCallback1_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
            {
                ASPxLabel1.Text = "Callback works!";
            }

     

    I hope there is a way to do this.

    Thanks,
    Thieme

  • Roma R (DevExpress)

    Re: Error: The target 'ASPxCallback1' for the callback could not be found or did not implement ICallbackEventHandler

    6/16/2008 5:03 AM
    • Top 50 Contributor
    • Joined on 5/4/2007
    • Posts 486
    Answer

    Hello

    The ASPxCallback component doesn't update any area in the html representation of a page, but has a client CallbackComplete event.
    If you want to use the ASPxCallback you need to modify your code in the following manner.

    UserControl ASPX code:

    <table cellpadding="0" cellspacing="0" style="width: 100%;">

        <tr>

            <td>

                <dxe:ASPxLabel ID="ASPxLabel1" runat="server" Text="UserControl 1 has been loaded successfully"

                    ClientInstanceName="lbl">

                </dxe:ASPxLabel>

            </td>

        </tr>

        <tr>

            <td style="padding-top: 10px; height: 54px;" align="center">

                <dxe:ASPxButton ID="okButton1" runat="server" Text="Ok" AutoPostBack="false">

                    <ClientSideEvents Click="function(s, e) { callback1.SendCallback(); } " />

                </dxe:ASPxButton>

            </td>

        </tr>

    </table>

    <dxcb:ASPxCallback ID="ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback"

        ClientInstanceName="callback1">

        <ClientSideEvents CallbackComplete="function(s, e) {

        lbl.SetText(e.result);

    }" />

    </dxcb:ASPxCallback>


    UserControl C# code:

    protected void ASPxCallback1_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) {

        e.Result = "Callback works!";

    }

    Page C# code:

     

        protected void Page_Load(object sender, EventArgs e) {

            if(Session["UC_Loaded"] != null && Request.Params["__CALLBACKID"] != "clbCallback") {

                Control resControl = Page.LoadControl(string.Format(UserControlPathTemplate, Session["UC_Loaded"]));

                if(resControl != null)

                    pcPopup.Controls.Add(resControl);

            }

        }

        protected void OnCallback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) {

            Control resControl = null;

            if(!string.IsNullOrEmpty(e.Parameter)) {

                resControl = Page.LoadControl(string.Format(UserControlPathTemplate, e.Parameter));

                Session["UC_Loaded"] = e.Parameter;

            }

            if(resControl != null) {

                pcPopup.Controls.Add(resControl);

                e.Result = ASPxCallback.GetRenderResult(resControl);

            }

        }

    Page JS code:

     

            function ShowPopup(userControlID) {

                popup.SetHeaderText("UserCotnrol " + userControlID);

                popup.SetContentHTML("Loading...");

                popup.Show();

     

                // We cannot use cache in this case         

                callback.SendCallback(userControlID);

            }


    But I would recommend that you use our ASPxCallbackPanel control for this purpose.

    UserControl ASPX code:

    <table cellpadding="0" cellspacing="0" style="width: 100%;">

        <tr>

            <td>

                <dxcp:ASPxCallbackPanel ID="ASPxCallbackPanel1" runat="server" ClientInstanceName="cbp"

                    Width="200px" OnCallback="ASPxCallbackPanel1_Callback">

                    <PanelCollection>

                        <dxp:PanelContent runat="server">

                            <dxe:ASPxLabel ID="ASPxLabel1" runat="server" Text="UserControl 1 has been loaded successfully"

                                ClientInstanceName="lbl">

                            </dxe:ASPxLabel>

                        </dxp:PanelContent>

                    </PanelCollection>

                </dxcp:ASPxCallbackPanel>

            </td>

        </tr>

        <tr>

            <td style="padding-top: 10px; height: 54px;" align="center">

                <dxe:ASPxButton ID="okButton1" runat="server" Text="Ok" AutoPostBack="false">

                    <ClientSideEvents Click="function(s, e) { cbp.PerformCallback(); } " />

                </dxe:ASPxButton>

            </td>

        </tr>

    </table>

    UserControl C# code:

     

    protected void ASPxCallbackPanel1_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) {

        ASPxLabel1.Text = "Callback works!";

    }


    Page C# code:

     

        protected void Page_Load(object sender, EventArgs e) {

            if(Session["UC_Loaded"] != null && Request.Params["__CALLBACKID"] != "clbCallback") {

                Control resControl = Page.LoadControl(string.Format(UserControlPathTemplate, Session["Loaded"]));

                if(resControl != null)

                    pcPopup.Controls.Add(resControl);

            }

        }

        protected void OnCallback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) {

            Control resControl = null;

            if(!string.IsNullOrEmpty(e.Parameter)) {

                resControl = Page.LoadControl(string.Format(UserControlPathTemplate, e.Parameter));

                Session["UC_Loaded"] = e.Parameter;

            }

            if(resControl != null) {

                pcPopup.Controls.Add(resControl);

                e.Result = ASPxCallback.GetRenderResult(resControl);

            }

        }

    Page JS code:

     

            function ShowPopup(userControlID) {

                popup.SetHeaderText("UserCotnrol " + userControlID);

                popup.SetContentHTML("Loading...");

                popup.Show();

     

                // We cannot use cache in this case         

                callback.SendCallback(userControlID);

            }

     

    Thanks, Roman
    R&D, .Net Team, DevExpress

    PS. If you wish to receive direct assistance from our Support Team, use Support Center.
  • Thieme

    Re: Error: The target 'ASPxCallback1' for the callback could not be found or did not implement ICallbackEventHandler

    6/16/2008 3:31 PM
    • Not Ranked
    • Joined on 3/20/2008
    • Posts 6

    Thank you very much for the quick en good post. The problem is now solved!

    For the people who want to copy this upper code. There is a little wrong code, in this section:

    Roman R (Developer Express):

        protected void Page_Load(object sender, EventArgs e) {

            if(Session["UC_Loaded"] != null && Request.Params["__CALLBACKID"] != "clbCallback") {

                Control resControl = Page.LoadControl(string.Format(UserControlPathTemplate, Session["Loaded"]));

                if(resControl != null)

                    pcPopup.Controls.Add(resControl);

            }

        }

    Replace: Session["Loaded"] with Session["UC_Loaded"]

    Thanks!

  • Roma R (DevExpress)

    Re: Error: The target 'ASPxCallback1' for the callback could not be found or did not implement ICallbackEventHandler

    6/17/2008 3:00 AM
    • Top 50 Contributor
    • Joined on 5/4/2007
    • Posts 486

    Thank you. It's my mistake.

     

    Thanks, Roman
    R&D, .Net Team, DevExpress

    PS. If you wish to receive direct assistance from our Support Team, use Support Center.
  • Adrian Bordones

    Re: Error: The target 'ASPxCallback1' for the callback could not be found or did not implement ICallbackEventHandler

    4/23/2010 7:04 PM
    • Not Ranked
    • Joined on 3/20/2009
    • Panama City
    • Posts 4

     Hi Roman!!!! Greetings from Panama City!!! Panama Canal & Ships & Cargo Ships!!!! jejeje!

    I work with DevExpress Controls, and I was reading your last post... and that

    kind of error: "The target 'ASPxCallback1' for the callback could not be found or did not implement ICallbackEventHandler"

    I solved it, locating my controls programmatically in the "Page_Init" event, and everything works too!

    had you tested that method before?

    Excuseme my English!!! It's not so good as yours, but I am working hardly to learn fluently.

    Adrian E. Bordones B.
    Microsoft Freelance Web Developer
  • faroca

    Re: Error: The target 'ASPxCallback1' for the callback could not be found or did not implement ICallbackEventHandler

    2/25/2011 5:04 AM
    • Not Ranked
    • Joined on 10/7/2010
    • Posts 3

    Supongo que hablas en español debido a tu ingles, jejeje.

    Me gustaría ver como lo solucionaste si puede ser porque estoy teniendo el mismo problema y me lleva loco.

     

     

    Gracias de antemano.

     

  • Adrian Bordones

    Re: Error: The target 'ASPxCallback1' for the callback could not be found or did not implement ICallbackEventHandler

    2/25/2011 8:32 AM
    • Not Ranked
    • Joined on 3/20/2009
    • Panama City
    • Posts 4

     Saludos hermano! A ver dime como te puedo ayudar? Smile  Si puedes enviar algo de código, con mucho gusto brother! aebordones@hotmail.com

    Adrian E. Bordones B.
    Microsoft Freelance Web Developer
More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.