By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,421 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

How to select particular Node and its child nodes in TreeView of ASP.Net 2005 ?

P: n/a
I have filled a treeview with parents and childs, using Hashtables.

Now, how can I check the required Parent and its Child Nodes.

for example, I have following data

Group
Item A
Item A1
Item A2
Item B
Item B1
Item B2

Now, I want to check the Item B, Item B1 and Item B2 Only, how can I ?

I have also saved the Keyvalues in the nodes, but still I don't know, how to
go to Item B ?
I know, that Item B has a Keyvalue B.

Any Idea please ?

Best Regards,

Luqman


Jun 5 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Is that what you're looking for?

foreach (TreeNode tn in tree.Nodes) {
if (tn.Text == "Item B") {
// you found it and can go for B1-Bn
}
}
"Luqman" <pe*******@cyber.net.pkwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>I have filled a treeview with parents and childs, using Hashtables.

Now, how can I check the required Parent and its Child Nodes.

for example, I have following data

Group
Item A
Item A1
Item A2
Item B
Item B1
Item B2

Now, I want to check the Item B, Item B1 and Item B2 Only, how can I ?

I have also saved the Keyvalues in the nodes, but still I don't know, how
to
go to Item B ?
I know, that Item B has a Keyvalue B.

Any Idea please ?

Best Regards,

Luqman


Jun 5 '07 #2

P: n/a
Hi,

for each loop will not find "Item B" as in VS 2005, the Group Node is the
Tree Main Node while Item A and Item B are childnodes of Group Node.

Best Regards,

Luqman
"AlexS" <sa***********@SPAMrogers.comPLEASEwrote in message
news:el**************@TK2MSFTNGP06.phx.gbl...
Is that what you're looking for?

foreach (TreeNode tn in tree.Nodes) {
if (tn.Text == "Item B") {
// you found it and can go for B1-Bn
}
}
"Luqman" <pe*******@cyber.net.pkwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>I have filled a treeview with parents and childs, using Hashtables.

Now, how can I check the required Parent and its Child Nodes.

for example, I have following data

Group
Item A
Item A1
Item A2
Item B
Item B1
Item B2

Now, I want to check the Item B, Item B1 and Item B2 Only, how can I ?

I have also saved the Keyvalues in the nodes, but still I don't know, how
to
go to Item B ?
I know, that Item B has a Keyvalue B.

Any Idea please ?

Best Regards,

Luqman



Jun 6 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.