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

Customising TitleBar from codebehind

1 Answer 63 Views
Dock
This is a migrated thread and some comments may be shown as answers.
tentonipete
Top achievements
Rank 1
tentonipete asked on 18 Feb 2009, 10:37 AM
I am writing a solution which means I have to create all of my docks programatically.

The problem I am coming across is creating the Commands in the TitleBar in the way I need them to look.

I have no problem creating custom commands and adding those (they appear on the right).

The only difference is that I require the DockExpandCollapseCommand on the left of the title.

// I want this to be a command, not a hyperlink, but I can't add commands to the controls collection
HyperLink hl = 
new HyperLink(); 
hl.NavigateUrl = "/url.aspx"
hl.Text = "CollapseCommand"
tempDock.TitlebarContainer.Controls.Add(hl); 

// Title
Label lbl = new Label(); 
lbl.Text = tempDock.Title; 
tempDock.TitlebarContainer.Controls.Add(lbl); 
 
// Create a command for the "Edit" button 
DockCommand cmd = new DockCommand(); 
cmd.Name = "cmdHelp"
cmd.AutoPostBack = false
cmd.CssClass = "helpButton"
cmd.Text = "Help"
tempDock.Commands.Add(cmd); 

I can add things to the TitlebarContainer but I'm not sure this is the right way to do things.

Ideally i want the layout:

[ CollapseCommand | Title                CustomCommand1 | CustomCommand 2 ]

Thanks for your help!

1 Answer, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 20 Feb 2009, 01:26 PM
Hello tentonipete,

You can add buttons(not dockCommands) to the titleBar template which will expand/collapse RadDock via javascript on the client. Also you can achieve the same visual effect with css, e.g.
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title>Untitled Page</title> 
    <style type="text/css">  
    .rdCollapse,  
    .rdExpand  
    {  
         position: relative;  
         left: -254px;  
    }  
    .rdTitle  
    {  
        padding-left: 24px !important;  
    }  
    </style> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
    <div> 
    <telerik:RadDockLayout ID="RadDockLayout1" runat="server">  
        <telerik:RadDock ID="RadDock1" runat="server" Title="Title" Width="300px">  
        </telerik:RadDock> 
    </telerik:RadDockLayout> 
    </div> 
    </form> 
</body> 
</html> 

Hope this helps!

All the best,
Petio Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Dock
Asked by
tentonipete
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Share this question
or