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

Custom title controls with itemplate

1 Answer 54 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Johnathan
Top achievements
Rank 1
Johnathan asked on 27 Sep 2010, 01:36 PM
Hi

I have several dynamically created dock windows and I want to add a hyperlinks into the titlebar. I've been trying to implent and itemplate class but not getting on that well..

As it stands heres what I have which does not seem to display anything in the titlebar
.....
Private
Function CreateRadDock(ByVal ItemType As Integer, ByVal itemid As Integer, ByVal DashItemId As Integer, ByVal row As Integer, ByVal title As String) As Telerik.Web.UI.RadDock
        Dim Placeholder As New PlaceHolder
        Dim dock As New RadDock()
        dock.DockMode = DockMode.Docked
        dock.ID = DashItemId.ToString
        dock.Title = title
        dock.Width = Unit.Percentage(100)
        dock.Height = Unit.Pixel(335)
        dock.AutoPostBack = True
        Dim titleBarTemplate = New DockTitleTemplate

..... etc

Do I need to call and add method to add the title bar template here?
Class DockTitleTemplate
    Implements ITemplate
    Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn
        Dim link1 As New HyperLink()
        link1.ID = "link1"
        link1.Text = "my linke text"
        link1.NavigateUrl = "#"
        container.Controls.Add(link1)
    End Sub
End Class


Currently this appears to do nothing and does not show my hyperlink in the titlebar. Your help or links to examples would be great. - Thanks..

Johnathan

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 30 Sep 2010, 01:30 PM
Hi Johnathan,

Here is an example on how to dynamically add a link element to the titlebar of RadDock:

    Private Function CreateRadDock() As RadDock
        Dim dock As New RadDock()
        dock.ID = String.Format("RadDock1")
        dock.Title = String.Format("Dock")
        dock.Text = String.Format("Added at {0}", DateTime.Now)
        dock.UniqueName = Guid.NewGuid().ToString()
        dock.Width = Unit.Pixel(300)
                Dim link1 As New HyperLink()
        link1.ID = "link1"
        link1.Text = "my linke text"
        link1.NavigateUrl = "#"

        dock.TitlebarContainer.Controls.Add(link1)
        Return dock
    End Function
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        Dim dock As RadDock = CreateRadDock()
        RadDockZone1.Controls.Add(dock)
    End Sub



Best wishes,
Rumen
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
Johnathan
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or