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

Treeview control on Dynamic Raddock

1 Answer 58 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Allan
Top achievements
Rank 1
Allan asked on 10 Aug 2010, 05:34 AM

Currently I'm having this kind of issue when creating a dynamic raddock and adding the treeview control on it. I also followed this demo http://demos.telerik.com/aspnet-ajax/dock/examples/myportal/defaultcs.aspx but still having a problem during expanding the treeview control or clicking on it.

The message says "The target 'ct100$ContentPlaceHolder1$RadDock3$C$Treeview1' for the callback could not be found or did not implement ICallBackEventHandler."

Please let me know how to find a way on this..

Here are my sample codes:

Private 

 

Sub LivelinkTreeView(ByVal treeview As RadTreeView)

 

 

 

 

 

 

Dim rootNode As New RadTreeNode()

 

rootNode.Text = hdnFundName.Value

rootNode.Value = hdnFundObjectID.Value

 

 

 

rootNode.ImageUrl = "~\App_Themes\Image\main.png"

 

 

 

 

 

 

rootNode.Width = "25"

 

 

 

 

 

 

rootNode.Height = "25"

 

 

 

 

 

 

rootNode.Expanded = True

 

 

 

 

 

 

rootNode.ExpandMode = TreeNodeExpandMode.ServerSideCallBack

 

treeview.Nodes.Add(rootNode)

 

 

 

End Sub 

 

 

 

 

 

Private Function CreateRadDock(ByVal c As Control, ByVal dockName As String, ByVal iCount As Integer) As RadDock 

 

 

 

Dim docksCount As Integer = CurrentDockStates.Count 

 

Dim dock As New RadDock()

 

 

 

dock.ID =

 

 

 

String.Format("RadDock" & iDockCount, iDockCount)

 

 

dock.Title =

 

 

 

String.Format(dockName)

 

 

dock.Font.Bold =

 

 

 

True

 

 

 

 

 

 

dock.UniqueName = Guid.NewGuid().ToString()

 

dock.Width = Unit.Percentage(100)

dock.Skin =

 

 

"Web20"

 

 

 

 

 

dock.OnClientInitialize = "OnClientInitialize"

 

 

 

 

 

 

dock.Attributes.Add("Style", "margin-top:10px;margin-left:10px")

 

 

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

dock.EnableDrag =

 

 

 

False

 

 

 

 

 

 

dock.EnableRoundedCorners = True

 

 

 

 

 

 

dock.EnableAnimation = True

 

 

 

 

 

 

dock.ContentContainer.Controls.Add(c) 

 

 

 

 

Return dock

 

 

 

End Function

 

 

 


Private Sub CreateDockDocumentInformation() 

 

 

 

 

 

 

LivelinkTreeView(rtvLivelink)

 

 

 

 

Dim dock As RadDock = CreateRadDock(Treeview1, "Document Information", icnt)

 

 

RadDockZone1.Controls.Add(dock)

iDockCount += 1

 

 

 

CreateSaveStateTrigger(dock)

 

 

LoadWidget(dock)

 

 

 

 

 

 

 

 

End Sub

 

 

 


 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

If Not IsPostBack Then

 

 

 

 

 

 

   CreateDockDocumentInformation()

 

 

 

 

 

 

End If

 

 

 

 

 

 

End Sub

 

 

 

 

 

 

 

 

 

 

Private Sub LoadWidget(ByVal dock As RadDock) 

 

If String.IsNullOrEmpty(dock.Tag) Then

 

 

 

 

 

 

Return

 

 

 

 

 

 

End If

 

 

 

 

 

 

Dim widget As Control = LoadControl(dock.Tag)

 

 

dock.ContentContainer.Controls.Add(widget)

 

 

 

 

End Sub

 

 

 

 

 

 

 

Private Sub CreateSaveStateTrigger(ByVal dock As RadDock)

 

 

 

 

 

dock.AutoPostBack = True

 

 

 

 

dock.CommandsAutoPostBack = True

 

 

 

 

 

Dim saveStateTrigger As New AsyncPostBackTrigger()

 

 

 

saveStateTrigger.ControlID = dock.ID

saveStateTrigger.EventName =

 

 

 

"DockPositionChanged"

 

 

 

 

 

 

UpdatePanel1.Triggers.Add(saveStateTrigger)

 

saveStateTrigger =

 

 

New AsyncPostBackTrigger()

 

 

saveStateTrigger.ControlID = dock.ID

saveStateTrigger.EventName =

 

 

"Command"

 

 

 

 

 

 

UpdatePanel1.Triggers.Add(saveStateTrigger)

 

 

 

 

End Sub

 

Is there any limitation on this on binding the treeview control on the dynamic raddock?

Thanks,
Allan

1 Answer, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 13 Aug 2010, 01:52 PM
Hi Allan,

I can't tell you for sure what's wrong with the code you sent. I tried the following code, where RadDock and RadTreeView are created dynamically and everything seems to be fine:
ASPX:
<%@ 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">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <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">
            </telerik:RadDockZone>
            <telerik:RadDockZone ID="RadDockZone2" runat="server">
            </telerik:RadDockZone>
        </telerik:RadDockLayout>
    </div>
    </form>
</body>
</html>
Codebehind:
Private RadTreeView1 As RadTreeView
    
  
    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Dim dock As New RadDock()
        dock.ID = "RadDock1"
        dock.UniqueName = "RadDock1"
        dock.Title = "RadDock1"
        RadDockZone1.Controls.Add(dock)
  
        RadTreeView1 = New RadTreeView()
        RadTreeView1.Height = Unit.Pixel(300)
        RadTreeView1.Width = Unit.Percentage(100)
        AddHandler RadTreeView1.NodeExpand, AddressOf RadTreeView1_NodeExpand
  
        dock.ContentContainer.Controls.Add(RadTreeView1)
    End Sub
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            LoadRootNodes(RadTreeView1, TreeNodeExpandMode.ServerSideCallBack)
        End If
    End Sub
    Private Shared Sub LoadRootNodes(ByVal treeView As RadTreeView, ByVal expandMode As TreeNodeExpandMode)
        For i As Integer = 0 To 3
            Dim node As New RadTreeNode()
            node.Text = i.ToString()
            node.Value = i.ToString()
            node.ExpandMode = expandMode
            treeView.Nodes.Add(node)
        Next
    End Sub
  
    Private Shared Sub PopulateNodeOnDemand(ByVal e As RadTreeNodeEventArgs, ByVal expandMode As TreeNodeExpandMode)
        For i As Integer = 0 To 3
            Dim node As New RadTreeNode()
            node.Text = i.ToString()
            node.Value = i.ToString()
            node.ExpandMode = expandMode
            e.Node.Nodes.Add(node)
        Next
  
        e.Node.Expanded = True
    End Sub
  
  
    Protected Sub RadTreeView1_NodeExpand(ByVal sender As Object, ByVal e As RadTreeNodeEventArgs)
        PopulateNodeOnDemand(e, TreeNodeExpandMode.ServerSideCallBack)
    End Sub
In case that you still have problems, please open a new support thread and send us a runnable project where we can observe the problem locally. Once we receive it, we will do our best to help you.


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