Cannot unregister UpdatePanel lllll HELP lllll

Rate It (1)

Last post 03-19-2007 3:31 PM by waynebest. 8 replies.

Sort Posts:

  • Cannot unregister UpdatePanel lllll HELP lllll

    03-07-2007, 2:12 AM
    • Loading...
    • JohnWood
    • Joined on 03-07-2007, 6:59 AM
    • Posts 7

    Hi all! 

    I am using Ajax v1.0, the latest release, and I am getting the following error:

    Cannot unregister UpdatePanel with ID 'up_add' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
    Parameter name: updatePanel

    I am dynamically loading user controls that contain updatepanels which in turn contain user controls with update panels (up_add is one them).

    Everything worked fine until I changed how  user controls load. I put everything back the way it was before I made the change but I cann't get rid of the above error.

    Regards,

    John Wood

  • Re:[*-)] Cannot unregister UpdatePanel lllll HELP lllll

    03-07-2007, 6:43 PM
    • Loading...
    • JohnWood
    • Joined on 03-07-2007, 6:59 AM
    • Posts 7
    Do you guys know why am I getting this error?
  • Re: Cannot unregister UpdatePanel lllll HELP lllll

    03-07-2007, 7:31 PM
    • Loading...
    • JohnWood
    • Joined on 03-07-2007, 6:59 AM
    • Posts 7

    This is the full error message:

     

    Cannot unregister UpdatePanel with ID 'up_adddeg' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
    Parameter name: updatePanel

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentException: Cannot unregister UpdatePanel with ID 'up_adddeg' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
    Parameter name: updatePanel

    Source Error:

    [No relevant source lines]

    Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\subtest\6ba95494\cb1a87fc\App_Web_ulz3rmbk.0.cs    Line: 0

    Stack Trace:

    [ArgumentException: Cannot unregister UpdatePanel with ID 'up_adddeg' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
    Parameter name: updatePanel]
    System.Web.UI.PageRequestManager.UnregisterUpdatePanel(UpdatePanel updatePanel) +215
    System.Web.UI.ScriptManager.System.Web.UI.IScriptManagerInternal.UnregisterUpdatePanel(UpdatePanel updatePanel) +53
    System.Web.UI.UpdatePanel.OnUnload(EventArgs e) +39
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +285
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Control.UnloadRecursive(Boolean dispose) +222
    System.Web.UI.Page.UnloadRecursive(Boolean dispose) +20
    System.Web.UI.Page.ProcessRequestCleanup() +41
    System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +158
    System.Web.UI.Page.ProcessRequest() +85
    System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +20
    System.Web.UI.Page.ProcessRequest(HttpContext context) +110
    ASP.therecruit_default_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\subtest\6ba95494\cb1a87fc\App_Web_ulz3rmbk.0.cs:0
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +317
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +65


    Version Information: Microsoft .NET Framework Version:2.0.50727.190; ASP.NET Version:2.0.50727.210
     

    Filed under:
  • Re: Cannot unregister UpdatePanel lllll HELP lllll

    03-07-2007, 7:33 PM
    • Loading...
    • JohnWood
    • Joined on 03-07-2007, 6:59 AM
    • Posts 7
    It looks like the bug is still there.Sleep
  • Re: Cannot unregister UpdatePanel lllll HELP lllll

    03-07-2007, 10:39 PM
    • Loading...
    • jodywbcb
    • Joined on 03-12-2003, 3:52 PM
    • West Seattle,WA
    • Posts 985

    Sad to say but the issue is with your code. 

     

    1. You can not remove a 'active Update panel' - meaning if the update occurs within that updatepanel you want to remove - and you try to remove it - you will get that error.

    2. You are trying to remove an Update Panel that resides in a custom control - that is still being dynamically loaded.

     

    Starters.  Evaluate the use of the Update Controls..  Seriously - updatepanel controls really should not be dynamically loaded and unloaded. instead the control that encapsulates the UpdatePanel control should be....that takes care of the issue..

     

    Otherwise - the error messages are kinda useless without code to actually reproduce the issue.  So, please post code to reproduce the issue as the error message merely indicates that within the page life cycle you are making a shortcut.. resulting in the error

    -- jody
    My Blogs on .Net 2.0 and Ajax
    http://csk.wbcb.com
    http://ArtbyJody.com
  • Re: Cannot unregister UpdatePanel lllll HELP lllll

    03-07-2007, 11:37 PM
    • Loading...
    • JohnWood
    • Joined on 03-07-2007, 6:59 AM
    • Posts 7

    It might be the code but everything worked fine before...

    To explain better this is the  scenario:

    I have a page that loads dynamic user controls in a no-ajax panel (let's call it P1). Each dynamic user control(UC1) has update panel (let's call it UP1). In the OnInit event of UC1 I add another user control(UC2) to no-ajax panel (P2), where P2 resides inside UP1.

    Before the error occurred, UC2 (the user control within user control) contained additional update panels, and this was handy because it allowed me to update only parts of the UC2. Now, the code works only if UC2 does not contain update panels.

     

    The error occurred when I tried to dynamically add UC2 from the Page instead of adding UC1 first and then in OnInit event add UC2. Again, I put everything the way it was before but no luck.

     

    Any suggestions? 

    Thanks for you help.

     

  • Re: Cannot unregister UpdatePanel lllll HELP lllll

    03-07-2007, 11:54 PM
    • Loading...
    • jodywbcb
    • Joined on 03-12-2003, 3:52 PM
    • West Seattle,WA
    • Posts 985

    Please provide code... hypothetical scenarios (even when you think they are the scenario - readers see it only as suggestive).. are impossible to provide resolutions for...

     

    Probably the bigest issue you are having is not recreating the page as it should be on the serverside - Asynch only means client side it has no relevance on the server as it has to re-create the entire page...  as it has no ideas...

     

     

    -- jody
    My Blogs on .Net 2.0 and Ajax
    http://csk.wbcb.com
    http://ArtbyJody.com
  • Re: Cannot unregister UpdatePanel lllll HELP lllll

    03-15-2007, 12:48 PM
    • Loading...
    • waynebest
    • Joined on 11-09-2006, 8:10 AM
    • Posts 25

    I have been trying to write a custom composite control that can be dynamically loaded. My control contains an UpdatePanel which, in turn, contains 4 ImageButtons and a TextBox control.

    I want to allow the user to create as many instances of my control as they like. I create the control in response to a Button Click event and then I add each newly created custom control to a Panel control and to the Session.  In the Page_Init method I handle the postback by getting each custom control from the Session and then re-adding the control to the Panel control. This is the point where I get the exception that you are describing.

    I tried calling ScriptManager.RegisterAsyncPostBackControl() passing in the UpdatePanel contained by my custom control, but I get the same exception.

    I have tried two approaches to writing the custom control; I first wrote my own control that was derived from CompositeControl and aggregated an UpdatePanel directly.
    Next I looked at Nikhil Kothari's sample and used his CompositionUpdatePanel class. I got the same exception with both approaches.
    Here is the link to Nikhil's sample:

    http://www.nikhilk.net/AtlasM2.2.aspx

    NOTE: I had to make a few minor changes to Nikhil's sample to get it to compile using the latest AJAX libraries.

    I am going to keep working on this - any ideas on how to get over this hurdle would be greatly appreciated.

    Thanks

  • Re: Cannot unregister UpdatePanel lllll HELP lllll

    03-19-2007, 3:31 PM
    • Loading...
    • waynebest
    • Joined on 11-09-2006, 8:10 AM
    • Posts 25

    As I mentioned in my last reply, I was looking at Nikhil Gothari's excellent custom UpdatePanel control. The control was written for an earlier version of AJAX, so in order to get it to run I had to make a couple of minor changes in the ContentControl class and the CompositionUpdatePanel class.

    I tried to post this at Nikhil's site, but it recommends that posts be done in the ASP.NET forums.

    Here is the modified code.

    From the CompositionUpdatePanel class:

            protected override void OnInit(EventArgs e){
                base.OnInit(e);
    
                //
                // 3/18/07 : 
                // Needed to use the ContentTEmplateContainer here..
                //
                // Controls.Clear();
                // Controls.Add(_content);
    
                ContentTemplateContainer.Controls.Clear();
                ContentTemplateContainer.Controls.Add(_content);
            }
    From the ContentControl class:
     
     
                protected override void Render(HtmlTextWriter writer){
                    //
                    // Again had to account for the ContentTemplateContainer.
                    //
                    // CompositionUpdatePanel updatePanel = (CompositionUpdatePanel)Parent;
    
                    CompositionUpdatePanel updatePanel = (CompositionUpdatePanel)Parent.Parent;
    
                    if (updatePanel._compositeControl != null) {
                        updatePanel._compositeControl.RenderUpdatePanel(updatePanel, writer);
                    }
                    else {
                        base.RenderChildren(writer);
                    }
                }
    
     

     

    I hope this helps anybody needing to do a composite control with an UpdatePanel.

     

Page 1 of 1 (9 items)
Microsoft Communities
Page view counter