I am working with ASP.Net Treeview and I need to check the existence of a node before adding a new node so that I don't have a duplication (which is what I am getting at the moment because of the state of the data.
I have tried TreeView1.FindNode(newNode.Text) which does get me a value if the nodes exists, but when trying to run a if statement on it to check its not nothing, or if it exists visual studio gives me an error to advise that cannot convert string to Boolean.
When trying
If Convert.ToBoolean(TreeView1.FindNode(node.Id)) = Nothing Then
exists = False
Else
exists = True
End If
this always returns false even if it is not nothing
when trying
If TreeView1.FindNode(node.Id) = Nothing Then
exists = False
Else
exists = True
End If`
this is where I get the error.
Any and all help would be very much appreciated.
thanks