Refresh user control within raddock

6 posts, 0 answers
  1. prayag ganoje
    prayag ganoje avatar
    127 posts
    Member since:
    Feb 2010

    Posted 26 Apr 2011 Link to this post

    Hello,

    I have a dynamically created raddcok and  in which user control is loaded.

    I want to update the user control contents on one of the command item click event. Well how is it possible to refresh the contents (may be page load event of the user control need to be called) ?

    Protected Sub RadDock_Command(ByVal sender As Object, ByVal e As DockCommandEventArgs)
          if  e.Command.Name = "doRefresh" Then
                Dim doc2Refresh As String = DirectCast(sender, RadDock).UniqueName
                ' expect to refresh user control loaded within raddock.
               End If
        End Sub


    Thanks.
  2. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 29 Apr 2011 Link to this post

    Hello Prayag,

    To refresh the user control within the dock, when one of the commands is pressed, you must place the user control inside an UpdatePanel, or wrap the content of the user control inside an UpdatePanel. Then in the Command event handler of the dock we should call the UpdatePanel's Update method in order to refresh its content. For your convenience I have modified the MyPortal demo to refresh a dock's content on a dock command. Please find it attached to the thread.

    All the best,
    Pero
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. prayag ganoje
    prayag ganoje avatar
    127 posts
    Member since:
    Feb 2010

    Posted 02 May 2011 Link to this post

    Thanks for the reply. Your example was very useful and it worked.

    But I also have raddocks loaded statically at design time along with the dynamically loaded raddocks. How can I refresh those ?

    Please see below code. 3 raddocks are loaded at the time of page load.

    <Martinbeeby:RadDockLayoutNew ID="RadDockLayout1" runat="server" OnLoadDockLayout="RadDockLayout1_LoadDockLayout"
        OnSaveDockLayout="RadDockLayout1_SaveDockLayout">
        <table style="width: 100%;" cellpadding="0" cellspacing="0" border="0">
            <tr align="left" style="padding-bottom: 5px; padding-top: 5px; padding-left: 0px;padding-right: 0px;">
                <td style="vertical-align: top; width: 33%; padding-left: 0px;padding-right: 0px;">
                    <Martinbeeby:RadDockZoneNew ID="RadDockZone1" runat="server" MinHeight="500px" Width="255px"
                        BorderStyle="None">
                        <Martinbeeby:RadDockNew ID="RadDock1" runat="server" Width="255px" EnableAnimation="true"
                            Resizable="false" Skin="Sitefinity" Tag="CSMD_Average_Response_Time" Text="CSMD_Average_Response_Time"
                            AutoPostBack="true" Title="Avg Response Time" CssClass="rdTitleBar" OnCommand="RadDock_Command"
                            OnDockPositionChanged="DockPositionChanged" DockMode="Docked">
                            <Commands>
                                <telerik:DockCloseCommand AutoPostBack="true" />
                                <telerik:DockCommand Name="doEdit" Text="Customize" AutoPostBack="true" CssClass="CustomCommandEdit" />
                                <telerik:DockCommand Name="doRefresh" Text="Refresh" AutoPostBack="true" CssClass="CustomCommandRefresh" />
                            </Commands>
                            <ContentTemplate>
                                <div>
                                    <uc1:AvgResponseTime ID="CSMD_Average_Response_Time" runat="server"></uc1:AvgResponseTime>
                                </div>
                            </ContentTemplate>
                        </Martinbeeby:RadDockNew>
                    </Martinbeeby:RadDockZoneNew>
                </td>
                <td style="vertical-align: top; width: 33%;padding-left: 0px;padding-right: 0px;">
                    <Martinbeeby:RadDockZoneNew ID="RadDockZone2" runat="server" MinHeight="500px" Width="255px"
                        BorderStyle="None">
                        <Martinbeeby:RadDockNew ID="RadDock2" runat="server" Width="255px" EnableAnimation="true"
                            Resizable="false" DockHandle="TitleBar" Tag="CSMD_Average_Resolution_Time_BL"
                            Text="CSMD_Average_Resolution_Time_BL" AutoPostBack="true" Skin="Sitefinity"
                            DockMode="Docked" Title="Avg Resolution Time Backline" OnCommand="RadDock_Command"
                            OnDockPositionChanged="DockPositionChanged">
                            <Commands>
                                <telerik:DockCloseCommand AutoPostBack="true" />
                                <telerik:DockCommand Name="doEdit" Text="Customize" AutoPostBack="true" CssClass="CustomCommandEdit" />
                                <telerik:DockCommand Name="doRefresh" Text="Refresh" AutoPostBack="true" CssClass="CustomCommandRefresh" />
                            </Commands>
                            <ContentTemplate>
                                <div>
                                    <uc3:AvgResolutionTimeBL ID="CSMD_Average_Resolution_Time_BL" runat="server"></uc3:AvgResolutionTimeBL>
                                </div>
                            </ContentTemplate>
                        </Martinbeeby:RadDockNew>
                    </Martinbeeby:RadDockZoneNew>
                </td>
                <td style="vertical-align: top; width: 33%;padding-left: 0px;padding-right: 0px;">
                    <Martinbeeby:RadDockZoneNew ID="RadDockZone3" runat="server" MinHeight="500px" Width="255px"
                        BorderStyle="None">
                        <Martinbeeby:RadDockNew ID="RadDock3" runat="server" Width="255px" EnableAnimation="true"
                            Resizable="false" DockHandle="TitleBar" Tag="CSMD_Average_Resolution_Time_FL"
                            Text="CSMD_Average_Resolution_Time_FL" AutoPostBack="true" Skin="Sitefinity"
                            DockMode="Docked" Title="Avg Resolution Time Frontline" OnCommand="RadDock_Command"
                            OnDockPositionChanged="DockPositionChanged">
                            <Commands>
                                <telerik:DockCloseCommand AutoPostBack="true" />
                                <telerik:DockCommand Name="doEdit" Text="Customize" AutoPostBack="true" CssClass="CustomCommandEdit" />
                                <telerik:DockCommand Name="doRefresh" Text="Refresh" AutoPostBack="true" CssClass="CustomCommandRefresh" />
                            </Commands>
                            <ContentTemplate>
                                <div>
                                    <uc2:AvgResolutionTimeFL ID="CSMD_Average_Resolution_Time_FL" runat="server"></uc2:AvgResolutionTimeFL>
                                </div>
                            </ContentTemplate>
                        </Martinbeeby:RadDockNew>
                    </Martinbeeby:RadDockZoneNew>
                </td>
            </tr>
        </table>
    </Martinbeeby:RadDockLayoutNew>
  5. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 03 May 2011 Link to this post

    Hello Prayag,

    Taking the idea from my previous example, you could easily achieve the same behavior with the static docks. Place the content of the user control inside an UpdatePanel, and on RadDock.Command event get a reference to the update panel, and call the Update method.

    Greetings,
    Pero
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  6. prayag ganoje
    prayag ganoje avatar
    127 posts
    Member since:
    Feb 2010

    Posted 06 May 2011 Link to this post

    Thanks Pero for the reply.

    I have 2 questions.

    1. Widget id "DockWidget" will only assigned when dock is loaded dynamically. How set widget id if it is a static dock since there is no need of any widget loading at very first time. You have used it as below:

    Dim updatePanel As UpdatePanel = DirectCast(dock.ContentContainer.FindControl("DockWidget").FindControl("Updatepanel1"), UpdatePanel)

    2. In this application, all the docks are getting refreshed if new dock is added into any of the zone. I want only newly added dock should get refreshed rest should not have any page load call. Youc can try this with label.ascx. keeping labels in all zones. if any of the new dock is added then all label will get refreshed.
  7. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 11 May 2011 Link to this post

    Hello Prayag,

    Straight to your questions:

    1. The code should be used for the dynamically created dock controls only. For the static ones you should not set ID to the dock, and use some other way to find the UpdatePanel inside the user control and call its Update method. For example, you could set the Tag property of the static docks to Static and then check if the Command event was initiated by a static dock. Then you could search the Controls collection of the dock to get a reference to the User Control, and finally get a reference to the UpdatePanel.
    Of course this is one way to use the idea of refreshing the dock.

    2. This is expected behavior, because the outermost UpdatePanel (the one containing all the zones and the layout) gets updated. To avoid this behavior you should use the approach from the following Code Library article: Code Library Article.

    All the best,
    Pero
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

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