Autor Beitrag
OKNER
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 19



BeitragVerfasst: Mo 19.06.06 19:29 
Hallo,

wie kann ich ein Treeview wieder nach dem Speichern ausklappen. Und zwar an der Stelle, wo ich zuletzt war.

Beispiel:
parent1
parent2
parent3
child1
child2
parent4
parent5

Also, wnn ich mich in Child2 befinde und die Seite abschicke (die Nodes im TreeView werden neu eingelesen), möchte ich wieder parent3 ausgeklappt haben und in die Details für Child2 anzeigen.


Hat jemand einen Tipp für mich? Komme da einfach nicht weiter.

Danke,
Renko
OKNER Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 19



BeitragVerfasst: Di 20.06.06 16:59 
Titel: meine Lösung
Habe jetzt selbst eine Lösung gefunden :-)

Aufruf nach dem Aktualisieren der Seite:

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
ExpandLastNode(TreeView1, lblParent.Text); //in lblParent.Text steht der Name des Parent-Node

    public static void ExpandLastNode(TreeView tv, String lastNode)
    {
        foreach (TreeNode node in tv.Nodes)
        {
            if (node.Text.Equals(lastNode)){
                node.Expand();
            }
        }
    }


Moderiert von user profile iconChristian S.: C#-Tags hinzugefügt