The implementation that form plan upholds in ASP.NET (3)
Tuesday, March 03, 2009 by rain
Three, revise, mobile burl dot
accuses as a result of the server do not support a mouse to procrastinate use incident,Cannot move mobile node through procrastinating in that way like Windows program so,The kind that carries choice father node is here.Shift is through be being deleted in former position,Reposition adds implementation,Should notice to save node information first when delete.
Private Sub TreeView1_SelectedIndexChange(ByVal Sender As Object, byVal E As Microsoft.Web.UI.WebControls.TreeViewSelectEventArgs) Handles TreeView1.SelectedIndexChange
Dim Dv As New DataView()Dv.Table = Ds.Tables("tree" )
Dim TmpNd As TreeNode = TreeNdSel(e.OldNode) , tmpNds As TreeNodeCollectionDv.RowFilter= "NODEID= "%26amp;TmpNd.IDDv(0)("NODE_DEscript") = Me.TextBox1.TextDv(0)("ADDRESS") = Me.TextBox2.TextDv(0)("TARGET") = Me.TextBox3.TextDv(0)("ICON") = Me.TextBox4.Text
If Dv(0)(%26quot;PARENTID%26quot;).ToString %26lt;%26gt;Me.DropDownList1.SelectedItem.Value Then
' mobile nodeDv(0)("PARENT_NAME") = Me.DropDownList1.SelectedItem.Value
If Me.DropDownList1.SelectedItem.Value = "ROOT" ThenTmpNds = TreeView1.Nodes
ElseTmpNds = FromIdToNode(Me.DropDownList1.SelectedItem.Value, treeView1.Nodes).Nodes ' the Nodes of new father node assembles
End If
GetNdCol(e.OldNode).Remove(tmpNd)TmpNds.Add(tmpNd)
End IfTmpNd.Text = Me.TextBox1.TextTmpNd.ImageUrl = Me.TextBox4.TextTmpNd = TreeView1.GetNodeFromIndex(TreeView1.SelectedNodeIndex)Dv.RowFilter= "NODEID= "%26amp;TmpNd.ID
Me.TextBox1.Text = Dv(0)("NODENAME").ToString
Me.TextBox2.Text = Dv(0)("ADDRESS").ToString
Me.TextBox3.Text = Dv(0)("TARGET").ToString
Me.TextBox4.Text = Dv(0)("ICON").ToString
End Sub
Private Function FromIdToNode(ByVal ID As String, byVal Nds As TreeNodeCollection) As TreeNode
' search node by key word
Dim I As Integer
Dim TmpNd As TreeNode, tmpNd1 As TreeNode
For Each TmpNd In Nds
If TmpNd.ID = ID Then
Return TmpNd
Exit Function
End IfTmpNd1 = FromIdToNode(ID, tmpNd.Nodes)
If Not (tmpNd1 Is Nothing) Then
Return TmpNd1
Exit Function
End If
Next
Return Nothing
End Function
Four, last word
The basic method that above elaborates shape of the tree in ASP.NET to show,And if where to undertake maintenance to cultivating node (increase, delete, revise, mobile) while,Modification database data.Be restricted as a result of length place,The author is mixed to main train of thought only here flow and crucial step made the introduction,Not listed and detailed source code,The reader can be perfected by oneself.The person that need detailed source code can be contacted with me,Article program is debugged below VS.NET, SQLServer, Windows 2000, IIS5.0 through. ...