RadDock client-side programming Questions - cloning - adding docks dynamically

2 posts, 0 answers
  1. Michael Hunt
    Michael Hunt avatar
    42 posts
    Member since:
    Aug 2009

    Posted 17 Oct 2014 Link to this post

    Hi,

    We are using version 2014.2.724.40 of you ASP.NET for AJAX controls.

    I'm experimenting with creating RadDocks dynamically via your client-side api.  I have a couple of questions.

    Q1) I've read in many forum posts that it cannot reliably / effectively / safely be done.  Is that still true?

    Currently, I'm cloning an existing RadDock using javascript, then I want to change a few of the properties that are saved with the Dock's state.  The first property I want to set or change, is the Dock's UniqueName property.  When I look at the RadDock in debug mode, I see that it has a set_uniqueName() method.  But you don't document that method in your help file.   When I use it to set the uniqueName property, it works.  I also use the undocumented set_tag() method...

    Q2)  How dangerous is it to use the Dock's set_uniqueName and set_tag methods, since they aren't documented?  I obviously don't want to risk using a method that might be changed or removed in the future.

    I use the Dock's Tag property to indicate what user control I want to load in the RadDock.  After I set these properties, I do an ajaxRequest postback to save the state of all the RadDocks.  All of this is working.

    My last step is to figure out how to reload the content of the newly added RadDock, without refreshing any of the other RadDocks.

    Presently, the new cloned RadDock contains the same user control as the one I cloned it from.  But I know I've saved the new state of it because if I reload the page (which reloads all the RadDocks), then the new cloned RadDock contains the correct user control.

    Q3)  Is there a client-side method I can use to reload the content (refresh) a specific RadDock, without refreshing the others?

    Thanks,
    Michael
  2. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 22 Oct 2014 Link to this post

    Hi Michael,

    When you use the clone method of RadDock the dock that is created exists only on the client and not on the server. This means that such docks will be removed when you perform a postback. When you implement scenario with dynamically created docks that should persist through postback you need to create them on the server as described in the following help article: http://www.telerik.com/help/aspnet-ajax/dock-control-creation.html

    The methods set_uniqueName and set_tag are not included in the documentation, because they are not implemented. They are generated automatically during the creation of the client-side API of the dock control.

    Updating the content only of selected docks is possible if you place a conditionally updated UpdatePanel that wraps the dock content in the ContentTemplate of each dock, similarly to the following setup:
    <telerik:RadDock runat="server" ID="RadDock1" Title="ContentTemplate">
        <ContentTemplate>
            <asp:UpdatePanel ID="Updatepanel1" runat="server">
                <ContentTemplate>
                    <asp:label ID="Label1" text="RadDock content" runat="server" />
                </ContentTemplate>
            </asp:UpdatePanel>
        </ContentTemplate>
    </telerik:RadDock>

    Overall, if you want the dynamically created docks to remain on the page after you perform a posback, I would suggest generating them on the code-behind.

    Regards,
    Slav
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top