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

Hiding docks from some people

1 Answer 20 Views
Dock
This is a migrated thread and some comments may be shown as answers.
RW
Top achievements
Rank 1
RW asked on 18 Dec 2008, 07:49 PM
What I have is a portal homepage, which is statically built (meaning I am not pulling the docks from a db or anything), what I want to be able to do is limit access of certain docks to certain people.  When they login depending on what type of user they are they will see different docks.  Normally I would use some if statements however code blocks are not supported.

What is the best way to acheive this?
Sorry for my ignorance I am fairly new with this excellent control suite.

Thanks in advance

jay

1 Answer, 1 is accepted

Sort by
0
Vyrban
Top achievements
Rank 1
answered on 22 Dec 2008, 11:19 AM
Hi jay.
I got the same issue and made an example , how i handle it. The example demostrate you how to hide docks by clicking the buttons , but you can integrate it in your code without buttons. Hope it will help you.
<form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
    <script type="text/javascript">  
        var User1 = new Array();  
        var User2 = new Array();  
        var DockAbsNumber = 0;  
        function dock_init(dock,args)  
        {   // some kind of simple rule, that define dock type (user1 visible or user2 visible)  
            if(DockAbsNumber%2==0)  
            {  
                User1.push(dock);  
            }  
            else  
            {  
                User2.push(dock);  
            }  
            DockAbsNumber++;  
        }  
          
        function set_visibility(user1,user2)  
        {  
            for(var i=0;i<User1.length;i++)  
            User1[i].set_visible(user1);  
            for(var i=0;i<User2.length;i++)  
            User2[i].set_visible(user2);  
        }  
          
        function button_click(button)  
        {     
            if(button.value == "User1")  
            {  
               set_visibility(true,false);  
            }  
            else  
            {  
                set_visibility(false,true);  
            }  
        }  
      
    </script> 
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">  
        <ContentTemplate> 
                <div style="float:left">  
        <telerik:RadDockZone ID="RadDockZone1" runat="server" Width="300px">  
            <telerik:RadDock ID="RadDock1" runat="server" Title="Dock1" OnClientInitialize="dock_init"></telerik:RadDock>    
            <telerik:RadDock ID="RadDock2" runat="server" Title="Dock2" OnClientInitialize="dock_init"></telerik:RadDock>    
            <telerik:RadDock ID="RadDock3" runat="server" Title="Dock3" OnClientInitialize="dock_init"></telerik:RadDock>            
        </telerik:RadDockZone> 
        </div> 
    <div> 
    <input id="Button1" type="button" value="User1" onclick="button_click(this)"/>  
    <input id="Button2" type="button" value="User2" onclick="button_click(this)"/>  
    </div> 
        </ContentTemplate> 
    </asp:UpdatePanel> 
 
    </form> 
Tags
Dock
Asked by
RW
Top achievements
Rank 1
Answers by
Vyrban
Top achievements
Rank 1
Share this question
or