I am using findnode method to find a node in the treeview but its returning nothing. Can anyone please go through the code below and tell where where I am getting error.
Protected
Sub Page_Load(ByVal sender
As Object,
ByVal e As System.EventArgs)
Handles Me.Load
'Dim contactIDReader As MySqlDataReader
Dim contactNameReader
As MySqlDataReader
Dim groupContacts
As New ArrayList
Dim index As
New Integer
If Not Page.IsPostBack
Then
Dim groupNode
As New TreeNode
Dim otherNode
As New TreeNode
groupNode.Text =
"Groups"
otherNode.Text =
"Others"
treeContacts.Nodes.Add(groupNode)
treeContacts.Nodes.Add(otherNode)
_commandString =
String.Format("select GroupID,GroupName from jukebox.group where UserID={0}", Session("SessionUserID"))
String.Format("select a.ContactID,a.FirstName from jukebox.contacts a,jukebox.groupdetails b where a.ContactID=b.ContactID and GroupID={0}",
_myDataReader(0).ToString)
kapilsanchih...
Participant
926 Points
206 Posts
problem using findnode method of the treeview
Feb 28, 2007 01:40 PM|LINK
Hello,
I am using findnode method to find a node in the treeview but its returning nothing. Can anyone please go through the code below and tell where where I am getting error.
Protected
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Dim contactIDReader As MySqlDataReader Dim contactNameReader As MySqlDataReader Dim groupContacts As New ArrayList Dim index As New Integer If Not Page.IsPostBack Then Dim groupNode As New TreeNode Dim otherNode As New TreeNodegroupNode.Text =
"Groups"otherNode.Text =
"Others"treeContacts.Nodes.Add(groupNode)
treeContacts.Nodes.Add(otherNode)
_commandString =
String.Format("select GroupID,GroupName from jukebox.group where UserID={0}", Session("SessionUserID"))_myDataReader = ManageDB.GetDataReader(_commandString)
While _myDataReader.ReadtreeContacts.FindNode(
"Groups").ChildNodes.Add(New TreeNode(_myDataReader(1).ToString, _myDataReader(0).ToString))_commandString =
String.Format("select a.ContactID,a.FirstName from jukebox.contacts a,jukebox.groupdetails b where a.ContactID=b.ContactID and GroupID={0}", _myDataReader(0).ToString)contactNameReader = ManageDB.GetDataReader(_commandString)
While contactNameReader.ReadtreeContacts.FindNode(
"Groups/" & _myDataReader(1).ChildNodes.Add(New TreeNode(contactNameReader(1).ToString, contactNameReader(0).ToString)) End WhilecontactNameReader.Close()
End While_myDataReader.Close()
End If End Subnode nodes treeview FindNode TreeNode link