I am trying to Refresh my tree view in an update panel on the right hand side of my page when the user drag's and drop's a single or multiple nodes. on the nodeDrop event it pops up an ajax pop up and takes the quantites for the given node to be dropped, on clicking the ok button it saves it to the database and then i want it to do a refresh on the destination node to bring the new quantities through.
am using the new web service method because where loading +5000 nodes.
Protected Sub DataStoreTreeView_NodeDrop(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeDragDropEventArgs)
Dim sourceNode As RadTreeNode = e.SourceDragNode
Dim destNode As RadTreeNode = e.DestDragNode
Dim dropPosition As RadTreeViewDropPosition = e.DropPosition
Session("SourceDragNode") = sourceNode
Session("DropPosition") = dropPosition
Session("DestDragNode") = destNode
If destNode IsNot Nothing Then
If sourceNode.TreeView.SelectedNodes.Count <= 1 Then
'Capture the Quantity
Me.QuantityTextBox.Text = "1"
Me.PartListQtyModalPopupExtender.Show()
Me.OKButton.Attributes.Add("onFocus", "javascript.this.select();")
CType(Master.FindControl("AJAXScriptManager"), ScriptManager).SetFocus(Me.OKButton)
Me.DataStoreUpdatePanel.Update()
PerformDragAndDrop(dropPosition, sourceNode, destNode)
ElseIf sourceNode.TreeView.SelectedNodes.Count > 1 Then
For Each node As RadTreeNode In sourceNode.TreeView.SelectedNodes
'need to sort
Next
End If
End If
destNode.Expanded = True
sourceNode.TreeView.ClearSelectedNodes()
End Sub
HERE IS THE OK BUTTON I WANT TO REFRESH AFTER.
Protected Sub OKButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'Add the dragged item as a new Part List Item
Dim strDestValue As String = ""
Dim intEnd As Integer
ReDim intPLParent(0)
If CType(Session("DestDragNode"), Telerik.Web.UI.RadTreeNode).Value = "0" Then
intPLParent(0) = 1
ElseIf Left(CType(Session("DestDragNode"), Telerik.Web.UI.RadTreeNode).Value, 2) = "PL" Then
strDestValue = CType(Session("DestDragNode"), Telerik.Web.UI.RadTreeNode).Value
intEnd = InStr(strDestValue, "~")
If intEnd > 0 Then
intPLParent(0) = Mid(strDestValue, 3, intEnd - 3)
Else
intPLParent(0) = Mid(strDestValue, 3)
End If
Else
strDestValue = CType(Session("DestDragNode"), Telerik.Web.UI.RadTreeNode).Value
intEnd = InStr(strDestValue, "~")
If intEnd > 0 Then
intPLParent(0) = Mid(strDestValue, 3, intEnd - 3)
Else
intPLParent(0) = Mid(strDestValue, 3)
End If
End If
'Adds the Selected nodes from data store to the DB for creating a PartList.
AddPartListItem(Session("SourceDragNode"), Session("DropPosition"), Session("DestDragNode"))
If Me.PartListTreeView.Nodes(0).Nodes.Count > 0 Then
Me.imgDeletePartList.Visible = True
Else
Me.imgDeletePartList.Visible = False
End If
End Sub
am using the new web service method because where loading +5000 nodes.
Protected Sub DataStoreTreeView_NodeDrop(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeDragDropEventArgs)
Dim sourceNode As RadTreeNode = e.SourceDragNode
Dim destNode As RadTreeNode = e.DestDragNode
Dim dropPosition As RadTreeViewDropPosition = e.DropPosition
Session("SourceDragNode") = sourceNode
Session("DropPosition") = dropPosition
Session("DestDragNode") = destNode
If destNode IsNot Nothing Then
If sourceNode.TreeView.SelectedNodes.Count <= 1 Then
'Capture the Quantity
Me.QuantityTextBox.Text = "1"
Me.PartListQtyModalPopupExtender.Show()
Me.OKButton.Attributes.Add("onFocus", "javascript.this.select();")
CType(Master.FindControl("AJAXScriptManager"), ScriptManager).SetFocus(Me.OKButton)
Me.DataStoreUpdatePanel.Update()
PerformDragAndDrop(dropPosition, sourceNode, destNode)
ElseIf sourceNode.TreeView.SelectedNodes.Count > 1 Then
For Each node As RadTreeNode In sourceNode.TreeView.SelectedNodes
'need to sort
Next
End If
End If
destNode.Expanded = True
sourceNode.TreeView.ClearSelectedNodes()
End Sub
HERE IS THE OK BUTTON I WANT TO REFRESH AFTER.
Protected Sub OKButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'Add the dragged item as a new Part List Item
Dim strDestValue As String = ""
Dim intEnd As Integer
ReDim intPLParent(0)
If CType(Session("DestDragNode"), Telerik.Web.UI.RadTreeNode).Value = "0" Then
intPLParent(0) = 1
ElseIf Left(CType(Session("DestDragNode"), Telerik.Web.UI.RadTreeNode).Value, 2) = "PL" Then
strDestValue = CType(Session("DestDragNode"), Telerik.Web.UI.RadTreeNode).Value
intEnd = InStr(strDestValue, "~")
If intEnd > 0 Then
intPLParent(0) = Mid(strDestValue, 3, intEnd - 3)
Else
intPLParent(0) = Mid(strDestValue, 3)
End If
Else
strDestValue = CType(Session("DestDragNode"), Telerik.Web.UI.RadTreeNode).Value
intEnd = InStr(strDestValue, "~")
If intEnd > 0 Then
intPLParent(0) = Mid(strDestValue, 3, intEnd - 3)
Else
intPLParent(0) = Mid(strDestValue, 3)
End If
End If
'Adds the Selected nodes from data store to the DB for creating a PartList.
AddPartListItem(Session("SourceDragNode"), Session("DropPosition"), Session("DestDragNode"))
If Me.PartListTreeView.Nodes(0).Nodes.Count > 0 Then
Me.imgDeletePartList.Visible = True
Else
Me.imgDeletePartList.Visible = False
End If
End Sub