TreeView1怎么获得ID请看源码谢谢
TryConn.Open()
' 连接本地SQL(Server数据库)
'Dim fph As String = ""
Dim Comm As New SqlCommand("Select * from d_sort ", Conn)
Dim d15 As SqlDataReader
d15 = Comm.ExecuteReader()
Dim myNodes() As TreeNode = New TreeNode(1000) {}
'初始化对象数组
Dim i As Integer
For i = 0 To myNodes.Length - 1 Step i + 1
myNodes(i) = New TreeNode()
Next
While d15.Read()
Dim iParentNodeId As Integer = CType(d15("code"), Integer)
Dim iMyNodeId As Integer = CType(d15("id"), Integer)
If iParentNodeId <> 0 Then
myNodes(iMyNodeId).Text = d15("type").ToString()
myNodes(iParentNodeId).ChildNodes.Add(myNodes(iMyNodeId))
Else
myNodes(iMyNodeId).Text = d15("type").ToString()
myNodes(iMyNodeId).SelectAction = TreeNodeSelectAction.None
TreeView1.Nodes.Add(myNodes(iMyNodeId))
End If
End While
Catch sqle As System.Exception
sqle.ToString().Replace("\n", "<br>")
Response.Write(sqle)
Finally
Conn.Close()
End Try
怎么获得ID谢谢帮一下 --------------------编程问答-------------------- vb看得好纠结,id看代码好像是设置在text上的,你运行下看下效果 --------------------编程问答-------------------- treeNode的ID,好像是name
也可以用字典类实现! --------------------编程问答-------------------- 就是这个iMyNodeId?
补充:.NET技术 , ASP.NET