ASPxClientFileManager.CustomCommand Event
Fires when a custom item is clicked, allowing you to perform custom actions.
#Declaration
CustomCommand: ASPxClientEvent<ASPxClientFileManagerCustomCommandEventHandler<ASPxClientFileManager>>
#Event Data
The CustomCommand event's data class is ASPxClientFileManagerCustomCommandEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
command |
Gets the name of the processed command. |
#Remarks
When a custom item is clicked, the CustomCommand event is raised, allowing you to perform custom actions. You can use the event argument’s ASPxClientFileManagerCustomCommandEventArgs.commandName parameter to identify a clicked button by its command name (FileManagerToolbarCustomButton.CommandName).
To learn more about toolbar items, see the Toolbar topic.
#Example
The code sample below demonstrates how to implement two custom toolbar buttons. The complete example is available in the following DevExpress online demo: File Manager - Custom Toolbar.
<dx:ASPxFileManager ID="FileManager" ClientInstanceName="FileManager" runat="server" OnCustomCallback="ASPxFileManager_CustomCallback">
<ClientSideEvents CustomCommand="OnCustomCommand"/>
<SettingsToolbar>
<Items>
<dx:FileManagerToolbarCustomButton Text="Thumbnails View" CommandName="ChangeView-Thumbnails" GroupName="ViewMode">
<Image IconID="grid_cards_16x16" />
</dx:FileManagerToolbarCustomButton>
<dx:FileManagerToolbarCustomButton Text="Details View" CommandName="ChangeView-Details" GroupName="ViewMode">
<Image IconID="grid_grid_16x16" />
</dx:FileManagerToolbarCustomButton>
</Items>
</SettingsToolbar>
</dx:ASPxFileManager>
protected void ASPxFileManager_CustomCallback(object source, CallbackEventArgsBase e) {
CurrentView = (FileListView)Enum.Parse(typeof(FileListView), e.Parameter.ToString());
}
function OnCustomCommand(s, e) {
switch(e.commandName) {
case "ChangeView-Thumbnails":
FileManager.PerformCallback("Thumbnails");
break;
case "ChangeView-Details":
FileManager.PerformCallback("Details");
break;
}
}