expressappframework-402157-getting-started-in-depth-tutorial-blazor-add-actions-menu-commands-add-a-simple-action.md
This lesson explains how to create a Simple Action — a button that executes custom code when a user clicks it.
The instructions below demonstrate how to add the Clear tasks button to the Employee Detail View. A click on this button clears all Tracked Tasks of the selected Employee.
Note
Before you proceed, take a moment to review the previous lessons:
Add a View Controller. In the Solution Explorer , right-click the Controllers folder in the MySolution.Module project and choose Add | New Item… In the opened dialog, select DevExpress 25.2 Template Kit , specify ClearContactTasksController as the new item’s name, and click Add. In the XAF platform section, select XAF Controllers | View Controller and click ADD ITEM.
Visual Studio displays an autogenerated ClearContactTasksController.cs file with a single View Controller declaration. In the controller constructor, specify the controller properties:
Add a new action to the controller and a handler for the action’s Execute event:
Run the application.
You can display an action’s button in a Detail View layout instead of a toolbar. Refer to the following topic for more information: How to: Include an Action in a Detail View Layout.
Note
CodeRush allows you to add Actions and Controllers with a few keystrokes. To learn about the Code Templates for XAF , refer to the following help topic: XAF Templates.
See Also