in
Forums
Blogs
DevExpress.com
Client Center
Support Center
DevExpress Channel

Error trying to PerformCallback from UserControl loaded via CallbackPanel

Last post 11/18/2008 7:38 AM by Andrew. 6 replies.
Sort Posts: Previous Next
  • 10/30/2008 8:30 AM

    • Andrew
    • Top 500 Contributor
    • Joined on 7/3/2007
    • South Africa
    • Posts 66

    Error trying to PerformCallback from UserControl loaded via CallbackPanel

    I feel like I am missing something fundamental here, so I hope someone can point it out to me..

    I have a website with an UpdatePanel as the main part of the default page. The content of the updatepanel is loaded from usercontrol's based on whichever menu options are selected. For simple scenarios this works fine but I have a problem with controls inside the usercontrols which try to use callbacks. I get an error: "The target '{verylongnametocallbackcontrol} for the callback could not be found or did not implement ICallbackEventHandler".

    I have attached a sample project illustrating the problem.

    I have checked this post which similar but even using an updatepanel in the usercontrol does not fix this problem for me.

    Any help would be much appreciated..

    Thanks

    Andrew

  • 10/31/2008 8:53 AM In reply to

    Re: Error trying to PerformCallback from UserControl loaded via CallbackPanel

    Hello Andrew

    I suggest that you change your code in the following manner:

     

        protected void Page_Load(object sender, EventArgs e) {

            if(Session["Loaded"] != null)

                LoadUserControl();

        }

        protected void cbpContent_Callback(object source, CallbackEventArgsBase e) {

            LoadUserControl();

            Session["Loaded"] = true;

        }

        private void LoadUserControl(){

            Control control2Render = null;

            ASPxCallbackPanel panel = source as ASPxCallbackPanel;

            //

            String controlPath = "~/TestUC.ascx";

            if(File.Exists(Server.MapPath(controlPath))) {

                control2Render = LoadControl(controlPath);

            }

            if(control2Render != null) {

                panel.Controls.Clear();

                panel.Controls.Add(control2Render);

            }

        }

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

    PS. If you wish to receive direct assistance from our Support Team, use Support Center.
  • 11/2/2008 12:58 AM In reply to

    • Andrew
    • Top 500 Contributor
    • Joined on 7/3/2007
    • South Africa
    • Posts 66

    Re: Error trying to PerformCallback from UserControl loaded via CallbackPanel

    Roman,

    Thanks for the reply, I realise now the problem is that when the nested callback fires, the usercontrol does not exist in the page output. I'll have to modify your suggestion for my menu driven page but that shouldn't be hard. Next problem is trying to get javascript in the usercontrol's to run, but I'll write up another post about that :-)

    Andrew

  • 11/6/2008 3:01 AM In reply to

    Re: Error trying to PerformCallback from UserControl loaded via CallbackPanel

    Hello Andrew

    Script blocks are not executed automatically when loaded during callbacks. We execute our script blocks by ourselves.
    You can use our mechanism by assigning an ID attribute to your script tag like "dxss_MyScript". For example:

    <script type="text/javascript" id="dxss_MyScript">...</script>

    Also, if you include script files to your usercontrol, I suggest that you refer to the following article.

    http://community.devexpress.com//forums/p/68526/233141.aspx#233141

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

    PS. If you wish to receive direct assistance from our Support Team, use Support Center.
  • 11/15/2008 5:01 AM In reply to

    • Andrew
    • Top 500 Contributor
    • Joined on 7/3/2007
    • South Africa
    • Posts 66

    Re: Error trying to PerformCallback from UserControl loaded via CallbackPanel

    Roman,

    Thanks, I finally got a chance to try this today, but I can't get my scripts to execute.

    I added the scripts directly into my user control's markup and gave the script block and id of 'dxss_Clients' but the scripts are still not recognized. I tried calling _aspxProcessScripts('TestOwner'); after my callback completes (so the new control/markup should be present on the client) but still no joy.

    I have attached the test p javaroject I created for the callback problem I had originally, modified to include a very simplescript call in the TestUC user control (_aspxProcessScripts is called in Default.aspx)

    Hope you can help..

    Thanks

    Andrew

  • 11/18/2008 4:49 AM In reply to

    Re: Error trying to PerformCallback from UserControl loaded via CallbackPanel

    Hello Andrew

    Seems all works fine for me. The client-side Refresh method is visible for script, and after clicking the Refresh button the "callback complete" message is shown.
    Which version of the Dxperience are you using? Try to upgrade to the latest one, and if it doesn't help, please feel free to post your complete project to our Support Center for investigation.

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

    PS. If you wish to receive direct assistance from our Support Team, use Support Center.
  • 11/18/2008 7:38 AM In reply to

    • Andrew
    • Top 500 Contributor
    • Joined on 7/3/2007
    • South Africa
    • Posts 66

    Re: Error trying to PerformCallback from UserControl loaded via CallbackPanel

    Roman,

    Thanks for your trouble, I still get an error saying the Refresh method doesn't exist on the client side after the callback.

    I was running 8.2.4, upgraded to 8.2.6 just to be sure, but still no joy.

    I have registered a question with support regarding this (Q136322).

    Andrew

Copyright © 1998-2010 Developer Express Inc.
ALL RIGHTS RESERVED