This is a migrated thread and some comments may be shown as answers.

Explorer control - "OnSelect" event?

5 Answers 170 Views
FileDialogs
This is a migrated thread and some comments may be shown as answers.
Dracus
Top achievements
Rank 1
Dracus asked on 08 Sep 2019, 12:58 PM

Hi team,

is there any way to read what is selected (single or multi select) when I click on folder/file in Explorer control?
Basically, I want to update my textbox with that what is selected.

Thx,
Oliver

5 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Sep 2019, 08:33 AM

Hello, Oliver,    

Note that the ExlorerControl internally uses a RadTreeView for displaying the hierarchical structure of files/folders. It is displayed on the left side of the ExlorerControl. On the right, it uses a RadListView.

In order to detect selection in both controls, feel free to use the following code snippet:

    
        public RadForm1()
        {
            InitializeComponent();

            this.explorerControl1.MainNavigationTreeView.SelectedNodeChanged += MainNavigationTreeView_SelectedNodeChanged;
            this.explorerControl1.FileBrowserListView.SelectedItemChanged += FileBrowserListView_SelectedItemChanged;
        }

        private void FileBrowserListView_SelectedItemChanged(object sender, EventArgs e)
        {
            if (this.explorerControl1.FileBrowserListView.SelectedItem != null)
            {
                Console.WriteLine(this.explorerControl1.FileBrowserListView.SelectedItem.Text);
            }
        }

        private void MainNavigationTreeView_SelectedNodeChanged(object sender, RadTreeViewEventArgs e)
        {
            Console.WriteLine("SelectedNode: " + e.Node.Text);
        }

I hope this information helps. If you need any further assistance please don't hesitate to contact me.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Dracus
Top achievements
Rank 1
answered on 18 Dec 2019, 06:20 PM

Hi Dess,

with huge delay thanks for update here.
Btw. how can I do that from VB.NET?

Thanks,
Oliver

0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 19 Dec 2019, 09:14 AM
Hello, Oliver,     

Please refer to the below code snippet in VB.NET:
    Public Sub New()
        InitializeComponent()
        AddHandler Me.ExplorerControl1.MainNavigationTreeView.SelectedNodeChanged, AddressOf MainNavigationTreeView_SelectedNodeChanged
        AddHandler Me.ExplorerControl1.FileBrowserListView.SelectedItemChanged, AddressOf FileBrowserListView_SelectedItemChanged
    End Sub

    Private Sub FileBrowserListView_SelectedItemChanged(ByVal sender As Object, ByVal e As EventArgs)
        If Me.ExplorerControl1.FileBrowserListView.SelectedItem IsNot Nothing Then
            Console.WriteLine(Me.ExplorerControl1.FileBrowserListView.SelectedItem.Text)
        End If
    End Sub

    Private Sub MainNavigationTreeView_SelectedNodeChanged(ByVal sender As Object, ByVal e As RadTreeViewEventArgs)
        Console.WriteLine("SelectedNode: " & e.Node.Text)
    End Sub
Feel free to use the free online Telerik Code Converter if you need to convert C# to VB.NET code and vice versa: http://converter.telerik.com/ 

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Dracus
Top achievements
Rank 1
answered on 19 Dec 2019, 05:41 PM

Thanks Dess. 

Btw. convertors is providing:

Public Sub New()

        InitializeComponent()
        Me.explorerControl1.MainNavigationTreeView.SelectedNodeChanged += AddressOf MainNavigationTreeView_SelectedNodeChanged
        Me.explorerControl1.FileBrowserListView.SelectedItemChanged += AddressOf FileBrowserListView_SelectedItemChanged
    End Sub

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 Dec 2019, 07:17 AM
Hello, Oliver,     

Indeed, the online converter may not provide absolutely correct VB.NET as the event subscriptions because it uses an external API for the conversion and we can't control the produced result. You may need to fix some small issues in order to build the code. However, the online converter can save you a lot of time when migrating a C# project or piece of code to VB.NET. Feel free to use it in future. 

Should you have further questions please let me know.

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
FileDialogs
Asked by
Dracus
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Dracus
Top achievements
Rank 1
Share this question
or