Events
This article lists the events specific to all of the RadFileDialog controls.
- OpenFileDialogForm.FormClosing: This event occurs when the dialog is closing. The event arguments are of type FormClosingEventArgs. You can use the arguments to cancel the event.
Example 1: Cancel dialog closing
OpenFileDialogForm.FormClosed: This event occurs when the dialog is closed. The event arguments are of type FormClosedEventArgs.
ExceptionRaised: This event occurs when an exception is raised. This event could be raised in different occasions, for example - if the selected folder cannot be accessed or if the file path is too long, or when there is an error while searching, etc.
Example 2: Showing an alert when an error appears
- DirectoryRequesting: This event can be used to filter the navigation RadTreeView. The following example demonstrates how you can filter out the "D:\" and "K:\" directories:
Example 3: Filtering the D and K directories
If the InitialDirectory of the RadFileDialog is filtered out as in Example 3, the current directory on load will be the default one.
Figure 1: Unfiltered Directories
Figure 2: Filtered Directories Based on Example 3
- OpenFileDialogForm.DirectoryNavigating: As of R1 2020 SP1, RadFileDialogs offer the DirectoryNavigating event. It occurs when the current folder is about to change. In the DirectoryNavigatingEventArgs you have access to the new directory path to be navigated via the DirectoryPath property. This event can be canceled. Hence, if the end-user doesn't have permissions for a specific folder, set the Cancel argument to true.