+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Error from UserControl with RadAjaxManager in edit mode

Error from UserControl with RadAjaxManager in edit mode

2 posts, 1 answered
  1. Alessio S.
    Alessio S. avatar
    37 posts
    Registered:
    31 May 2010
    17 Jan 2011
    Link to this post
    Hi,
    I have created a custom UserControl which has a RadAjaxManager, a RadGrid and a few controls for search criteria which trigger refreshing of the grid. I put the UserControl in the list of available controls and put it into a page along with some generic content blocks.
    When I go to the page in edit mode from the site backend, I can modify the generic content blocks on the same page as usual. However if I try to drag & drop them around to change position or to add/remove any block from the page I get this error. (Even though I get the error, the change I made is actually persisted if I hit back on the browser and publish the page.)

    Server Error in '/' Application.
     
    A control with ID 'des2$ctl04$ctl06$RadGridAgevolazioni' could not be found for the trigger in UpdatePanel 'des2$ctl04$ctl06$RadGridAgevolazioniPanel'.
     
    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.InvalidOperationException: A control with ID 'des2$ctl04$ctl06$RadGridAgevolazioni' could not be found for the trigger in UpdatePanel 'des2$ctl04$ctl06$RadGridAgevolazioniPanel'.
     
    Source Error:
     
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
     
    Stack Trace:
     
     
    [InvalidOperationException: A control with ID 'des2$ctl04$ctl06$RadGridAgevolazioni' could not be found for the trigger in UpdatePanel 'des2$ctl04$ctl06$RadGridAgevolazioniPanel'.]
       System.Web.UI.UpdatePanelControlTrigger.FindTargetControl(Boolean searchNamingContainers) +329745
       System.Web.UI.AsyncPostBackTrigger.Initialize() +27
       System.Web.UI.UpdatePanelTriggerCollection.Initialize() +76
       System.Web.UI.UpdatePanel.Initialize() +40
       System.Web.UI.UpdatePanel.OnLoad(EventArgs e) +52
       System.Web.UI.Control.LoadRecursive() +50
       System.Web.UI.Control.AddedControl(Control control, Int32 index) +265
       System.Web.UI.ControlCollection.Add(Control child) +80
       Telerik.Web.UI.RadAjaxControl.CreateUpdatePanel(Control initiator, String eventName, Control updated, UpdatePanelRenderMode panelRenderMode) +1079
       Telerik.Web.UI.RadAjaxControl.OnPagePreRender(Object sender, EventArgs e) +1350
       System.EventHandler.Invoke(Object sender, EventArgs e) +0
       System.Web.UI.Control.OnPreRender(EventArgs e) +8682950
       Telerik.Cms.Web.EditPage.OnPreRender(EventArgs e) +14
       System.Web.UI.Control.PreRenderRecursiveInternal() +80
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
     
    Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3614

    The UserControl is quite straightforward, it has a RadGrid with a simple item template (just showing fields from the datasource items). The other controls inside the ajax panel are RadListBoxes which fire the ajax update when a checkbox is checked/unchecked. The RadAjaxManager has all the listboxes set to fire updates for the RadGrid and the RadGrid firing updates for itself (because of paging buttons etc.)
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    17 Jan 2011
    Link to this post
    Hello Alessio,

    In the page editor, the page object is null and it is possible to see such a issues. This is why in the controls in which you would Ajax is preferable to create the child controls if Page is not null. Therefore there is no ScriptManager and AjaxManager. For example you can achieve something like the Events View controls - saying that the control can not be rendered in Design mode. Sample can be found here:
    http://www.sitefinity.com/blogs/radoslavgeorgiev/posts/09-12-03/group_appointments_by_event_categories_in_a_custom_events_schedule_view.aspx

    Also when working with Ajax and Sitefinity there is one thing to consider. Since your controls are packed into user controls and are not part of the top level page markup it is preferable to add RadAjaxManager on your master page. Then in the controls where you need the RadAjaxManager control you should use RadAjaxManagerProxy and subscribe to the AjaxRequest event through the code not markup. You can check the following links for more information on the Proxy control:
    RadAjax and UserControls
    RadAjax and Master/Content Pages


    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
2 posts, 1 answered