Bug in RadDock?

2 posts, 0 answers
  1. dburgett
    dburgett avatar
    8 posts
    Member since:
    Oct 2006

    Posted 18 Aug 2008 Link to this post

    I have found an issue trying to change the content of a RadDock after the dock has been moved.  Specifically, I can change the content with server-side code prior to moving the RadDock around on the page...after I move it, I get the following error:


    Sys.InvalidOperationException: Two components with the same id 'RadDock1' can't be added to the application.

    Here's the code for a very simple example is below. One RadDock and buttons. 

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />

    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px">

    <telerik:RadDock ID="RadDock1" runat="server" Width="300px">

    <ContentTemplate>

    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

    </ContentTemplate>

    </telerik:RadDock>

    <br />

    <br />

    <br />

    <asp:Button ID="Button1" runat="server" Text="Button" />

    </telerik:RadAjaxPanel>


    Clicking the button changes the text of the label inside the RadDock:

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

    label1.text =

    "1"

    End Sub



    To demonstrate the bug: Load the page, click the button. The text inside the RadDock changes correctly. Now drag the RadDock to somewhere else on the page and click the button again. The JavaScript error listed above occurs.


    Is this not correct use of this control? Is there something I'm missing?

    Thanks,
    david

  2. Obi-Wan Kenobi
    Obi-Wan Kenobi  avatar
    460 posts
    Member since:
    Aug 2007

    Posted 19 Aug 2008 Link to this post

    This problem is not in RadDock control. Once you drag it, the RadDock position in the dom is changed. When you press the button a new RadDock with the same ID is added to the Page but the old one is still there.
    If you want to use RadDock with Ajax, you should use one of the following approaches:
     - If you want to update only the content in the RadDock you should add an update panel in the RadDock and add all content into the update panel. You can update the content with triggers. A simple example illustrating this you can find here:
    http://www.telerik.com/DEMOS/ASPNET/Prometheus/Dock/Examples/Default/DefaultCS.aspx
    - You can create all RadDocks with DockMode = Docked  and update all RadDockZones on every Ajax call.
    - If you want to save the dock positions on the server, you can use the following example as a reference:
    http://www.telerik.com/DEMOS/ASPNET/Prometheus/Dock/Examples/MyPortal/DefaultCS.aspx

    If you want to update only the content in the RadDock, my suggestion is to use the first approach.
Back to Top