This is a migrated thread and some comments may be shown as answers.

why skin don't save

1 Answer 45 Views
Dock
This is a migrated thread and some comments may be shown as answers.
HL
Top achievements
Rank 1
HL asked on 05 May 2010, 03:03 PM
hi all:
   I added dock dynamically to the three zones.I set up different skin for each Zone. After user log back in and reloaded the docks which  have been saved, the skin setting doesn't work.  how could I fix this issue?

what I need is that every dock in the same zone have the same color. I also wonder how could I set up each dock has it own title bar color?

Thanks
Helena


 

 <telerik:RadDockLayout runat="server" ID="RadDockLayout1"   
               EnableViewState="true">  
                 <table style="width:100%" border="0" > 
                 <tr > 
                  <td style="width:30%">  
                     <telerik:RadDockZone runat="server" ID="RadDockZone1" Height="100%"   
                       FitDocks="true" Width="100%" MinHeight="0" BorderWidth="0" Orientation="Vertical" Skin="Outlook">  
                         
                    </telerik:RadDockZone> 
                  </td> 
                  <td style="width:30%" > 
                       <telerik:RadDockZone runat="server" ID="RadDockZone2" Height="100%"   
                           Width="100%"    
                           Style="_height:100%;border-color:lightgray;float:  right; margin-right: 0px"   
                           Orientation="Vertical" FitDocks="true" Skin="WebBlue">  
                        </telerik:RadDockZone> 
                    </td> 
                   <td style="width:30%">  
                       <telerik:RadDockZone runat="server" ID="RadDockZone3" Height="100%"   
                           Width="100%"  Style="_height:100%;border-color:lightgray;float: right; margin-right: 0px"   
                           Orientation="Vertical" FitDocks="true" Skin="Vista">  
                       </telerik:RadDockZone> 
                   </td> 
                </tr> 
                </table>   
 
 
 
vb.net codes:  
 Private Sub CreateDefaultRadDock()  
        Dim index As Integer  
        Dim DockList As New ArrayList()  
        Dim intCount As Integer = 0 
        Dim intReminder As Integer  
        Dim dock As RadDock  
        If Not Me.chkWidgetList.Items Is Nothing Then  
            intCount = Me.chkWidgetList.Items.Count  
        End If  
 
        For index = 0 To intCount - 1  
            dock = CreateRadDock(chkWidgetList.Items(index).Text)  
            intReminder = index Mod 3  
            Select Case intReminder  
                Case 0  
                    RadDockZone1.Controls.Add(dock)  
                    dock.Skin = "Web20" 
 
                Case 1  
                    RadDockZone2.Controls.Add(dock)  
                    dock.Skin = "Vista" 
                Case 2  
                    RadDockZone3.Controls.Add(dock)  
                    dock.Skin = "Outlook" 
            End Select  
            Me.chkWidgetList.Items(index).Selected = True 
            'We want to save the dock state every time a dock is moved.         
            CreateSaveStateTrigger(dock)  
            'Load the selected widget         
            dock.Tag = WidgetFolder + "/" + chkWidgetList.Items(index).Value  
 
            LoadWidget(dock)  
        Next index  
 
        Me.btnAdd.Enabled = False 
        Me.btnReset.Enabled = False 
 
        'don't need to reload Dock   
        isNeedReload = False 
 
    End Sub  
         

1 Answer, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 06 May 2010, 04:13 PM
Hi,

The code below shows a simple example which illustrates how to change RadDock's skins depending on the parent RadDockZone:

ASPX:
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
        </Scripts>
    </asp:ScriptManager>
    <div>
          
        <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
            <table style="width:100%" border="0" >  
                 <tr >  
                  <td style="width:30%">   
                     <telerik:RadDockZone runat="server" ID="RadDockZone1" Height="100%"    
                       FitDocks="true" Width="100%" MinHeight="0" BorderWidth="0" Orientation="Vertical" Skin="Outlook">   
                            
                    </telerik:RadDockZone>  
                  </td>  
                  <td style="width:30%" >  
                       <telerik:RadDockZone runat="server" ID="RadDockZone2" Height="100%"    
                           Width="100%"     
                           Style="_height:100%;border-color:lightgray;float:  right; margin-right: 0px"    
                           Orientation="Vertical" FitDocks="true" Skin="WebBlue">   
                        </telerik:RadDockZone>  
                    </td>  
                   <td style="width:30%">   
                       <telerik:RadDockZone runat="server" ID="RadDockZone3" Height="100%"    
                           Width="100%"  Style="_height:100%;border-color:lightgray;float: right; margin-right: 0px"    
                           Orientation="Vertical" FitDocks="true" Skin="Vista">   
                       </telerik:RadDockZone>  
                   </td>  
                </tr>  
                </table>  
        </telerik:RadDockLayout>
        <asp:Button ID="Button1" runat="server" Text="Postback"/>
         
    </div>
    </form>
</body>
</html>
Codebehind:
Protected Overrides Sub OnInit(ByVal e As EventArgs)
    MyBase.OnInit(e)
    Dim dock As RadDock = CreateRadDock("RadDock1")
    RadDockZone1.Controls.Add(dock)
    dock = CreateRadDock("RadDock2")
    RadDockZone2.Controls.Add(dock)
    dock = CreateRadDock("RadDock3")
    RadDockZone3.Controls.Add(dock)
End Sub
Protected Function CreateRadDock(ByVal ID As String) As RadDock
    Dim dock As New RadDock()
    dock.ID = ID
    dock.Title = ID
    dock.UniqueName = ID
    dock.AutoPostBack = True
    Return dock
End Function
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    ChangeSkinDependingOnParentZone()
End Sub
Protected Sub ChangeSkinDependingOnParentZone()
    For Each dock As RadDock In RadDockLayout1.RegisteredDocks
        Dim dockZoneId As String = dock.DockZoneID
        Select Case dockZoneId
            Case "RadDockZone1"
                dock.Skin = "Outlook"
                Exit Select
            Case "RadDockZone2"
                dock.Skin = "WebBlue"
                Exit Select
            Case "RadDockZone3"
                dock.Skin = "Vista"
                Exit Select
            Case Else
                dock.Skin = "Default"
                Exit Select
        End Select
    Next
End Sub

If you want to modify the TitleBar, my suggestion is to use TitlebarTemplate as is shown in the following example:

http://demos.telerik.com/aspnet-ajax/dock/examples/edittitle/defaultcs.aspx

Let us know how it goes and in case you need further assistance.


All the best,
Petio Petkov
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.
Tags
Dock
Asked by
HL
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Share this question
or