Custom title controls with itemplate

2 posts, 0 answers
  1. Johnathan
    Johnathan avatar
    18 posts
    Member since:
    Aug 2010

    Posted 27 Sep 2010 Link to this post


    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
    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 = "#"
        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..

  2. Rumen
    Rumen avatar
    14028 posts

    Posted 30 Sep 2010 Link to this post

    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 = "#"

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

    Best wishes,
    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
Back to Top