Get TreeView Selected Node using C# and VB.Net in ASP.Net

Last Reply 11 months ago By Andrea

Posted 11 months ago

Hi All

How to get the header for selected header treeview node in C#


<treeview margin="5" background="White" grid.column="0" grid.rowspan="2" x:name="treeGRNDetails"
    selecteditemchanged="treeGRN_SelectedItemChanged" />


private void treeGRN_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)


public void ConstructTree()
    TreeViewItem Inbox = new TreeViewItem() { Header = "Inbox" };
    TreeViewItem Completed = new TreeViewItem() { Header = "Completed" };
    DLGRNCreation gritem = new DLGRNCreation();
    DLGRNTreeData deliveryNoteTreeData = (DLGRNTreeData)purchaseordernumber.GetGRNTreeData(gritem);
    if (deliveryNoteTreeData != null)
        Inbox.ItemsSource = deliveryNoteTreeData.GRNTreeOrders;
        Completed.ItemsSource = deliveryNoteTreeData.CompletedOrders;
    if (treeGRNDetails.Items.IsEmpty == true)


thanks and regards


Posted 11 months ago
Hi @sanvi,
Please try the following

Get TreeView Selected Node in SelectedIndexChanged event in ASP.Net

It might help you.

Cheers Andrea.