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

Last Reply 11 days ago By Andrea

Posted 11 days ago

Hi All

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

HTML

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

Code

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)
    {
        treeGRNDetails.Items.Add(Inbox);
        treeGRNDetails.Items.Add(Completed);
    }
}

 

thanks and regards

siddu

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

Get TreeView Selected Node in SelectedIndexChanged event in ASP.Net

It might help you.

Cheers Andrea.