Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,

Can anyone tell me how to check in treeview node is exist?
Posted
Updated 19-Dec-12 22:08pm
v5
Comments
Orcun Iyigun 20-Dec-12 1:24am    
It is throwing the exception because the value is null. Put a debugger and check the value where you get the exception..

1 solution

simple use this code

SQL
if(treeView1.Nodes.ContainsKey("Item1")){

}
 
Share this answer
 
Comments
Sweetynewb 20-Dec-12 4:37am    
I am using vs 2.0.-> web application.
there is no property-"containskey"
What to do?
Thomas Daniels 20-Dec-12 4:41am    
ConainsKey isn't a property, but a function.
Menon Santosh 20-Dec-12 4:47am    
go through this article

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.findnode.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900