ASPxClientFileManager.ToolbarUpdating Event
Fires on the client side when the file manager updates the state of toolbar or context menu items.
Declaration
ToolbarUpdating: ASPxClientEvent<ASPxClientFileManagerToolbarUpdatingEventHandler<ASPxClientFileManager>>
Event Data
The ToolbarUpdating event's data class is ASPxClientFileManagerToolbarUpdatingEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
activeAreaName | Gets the name of the currently active file manager area. |
Remarks
Write the ToolbarUpdating event handler to control the state of custom toolbar and context menu items. You can use the ASPxClientFileManagerToolbarUpdatingEventArgs.activeAreaName event argument property to determine the currently active area.
A particular item can be accessed by its command name using the ASPxClientFileManager.GetToolbarItemByCommandName and ASPxClientFileManager.GetContextMenuItemByCommandName methods, which return a ASPxClientFileManagerToolbarItem object. You can use the object members to control the item availability.
Example
The complete example is available in the following DevExpress online demo: File Manager - Custom Toolbar.
<dx:ASPxFileManager ID="FileManager" ClientInstanceName="FileManager" runat="server">
<ClientSideEvents ToolbarUpdating="OnToolbarUpdating" />
<SettingsToolbar>
<Items>
<dx:FileManagerToolbarCustomButton CommandName="Properties">
<Image IconID="setup_properties_16x16" />
</dx:FileManagerToolbarCustomButton>
...
function OnToolbarUpdating(s, e) {
var enabled = (e.activeAreaName == "Folders" || FileManager.GetSelectedItems().length > 0) && e.activeAreaName != "None";
FileManager.GetToolbarItemByCommandName("Properties").SetEnabled(enabled);
}