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

Discussion in 'ASP .Net' started by Luqman, Jun 5, 2007.

  1. Luqman

    Luqman Guest

    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
     
    Luqman, Jun 5, 2007
    #1
    1. Advertising

  2. Luqman

    AlexS Guest

    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" <> wrote in message
    news:%...
    >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
    >
    >
    >
    >
     
    AlexS, Jun 5, 2007
    #2
    1. Advertising

  3. Luqman

    Luqman Guest

    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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:%...
    >>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
    >>
    >>
    >>
    >>

    >
    >
     
    Luqman, Jun 5, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    3,986
    Thomas Weidenfeller
    Mar 31, 2005
  2. Bryan Ax
    Replies:
    6
    Views:
    555
    Peter Flynn
    May 17, 2006
  3. Replies:
    1
    Views:
    592
    Soren Kuula
    Aug 24, 2006
  4. Replies:
    1
    Views:
    1,215
    Joe Kesselman
    Nov 1, 2006
  5. William  Krick
    Replies:
    4
    Views:
    14,556
    anntenna
    Mar 18, 2011
Loading...

Share This Page