Disable close and collapse

4 posts, 0 answers
  1. John
    John avatar
    34 posts
    Member since:
    Apr 2008

    Posted 04 Sep 2009 Link to this post

    Hi - how do I programatically disable (hide) the close and collapse buttons on a dock?

    I need only administrators to have that option.

    Thanks
  2. Vyrban
    Vyrban avatar
    31 posts
    Member since:
    Nov 2008

    Posted 04 Sep 2009 Link to this post

    Hi,
    try this one:
    ASPX:
        <form id="form1" runat="server"
           <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
        <div> 
            <telerik:RadDockLayout ID="RadDockLayout1" runat="server"
            <telerik:RadDockZone ID="RadDockZone1" runat="server" Width="300px"
                <telerik:RadDock ID="RadDock1" runat="server" DefaultCommands="All"></telerik:RadDock> 
            </telerik:RadDockZone> 
            </telerik:RadDockLayout> 
            <asp:Button ID="Button1" runat="server" Text="Toggle Commands" OnClick="Button1_Click"/> 
        </div> 
        </form> 
    Code behind:
        protected void Button1_Click(object sender, EventArgs e) 
        { 
            if (RadDock1.DefaultCommands != Telerik.Web.UI.Dock.DefaultCommands.None) 
            { 
                RadDock1.DefaultCommands = Telerik.Web.UI.Dock.DefaultCommands.None; 
            } 
            else 
            { 
                RadDock1.DefaultCommands = Telerik.Web.UI.Dock.DefaultCommands.All; 
            } 
        } 

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John
    John avatar
    34 posts
    Member since:
    Apr 2008

    Posted 04 Sep 2009 Link to this post

    Hmmm - your exmple works but in my app I am dynamically creating the docs:

     

    if (IsAdministrator)

     

    {

    dock.EnableDrag =

    true;

     

    dock.DefaultCommands = Telerik.Web.UI.Dock.

    DefaultCommands.Close;

     

    }

     

    else

     

    {

    dock.EnableDrag =

    false;

     

    dock.DefaultCommands = Telerik.Web.UI.Dock.

    DefaultCommands.None;

     

    }

     

     

    RadDockLayout1.Controls.Add(dock);

    it's definately hitting the line where we set the commands to 'none' but the close and collapse icons are still there and they are functional.

    Any ideas?

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

    Posted 08 Sep 2009 Link to this post

    On my opinion you should change the commands after Page_Init, e.g. Page_Load
    I tried the code below and everything seems to be fine:
     RadDock dock;  
        protected override void OnInit(EventArgs e)  
        {  
            base.OnInit(e);  
            dock = new RadDock();  
            dock.ID = "newDock";  
            RadDockZone1.Controls.Add(dock);  
           
        }  
        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (dock.DefaultCommands != Telerik.Web.UI.Dock.DefaultCommands.None)  
            {  
                dock.DefaultCommands = Telerik.Web.UI.Dock.DefaultCommands.None;  
            }  
            else 
            {  
                dock.DefaultCommands = Telerik.Web.UI.Dock.DefaultCommands.All;  
            }  
        } 
Back to Top