Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Collapse]eXpressApp Framework
 [Expand]Fundamentals
 [Expand]Getting Started
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Expand]Deployment
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Collapse]Actions
    How to: Add a Search Action to Lookup Property Editors and Link Pop-up Windows
    How to: Add the Analyze Action to List Views
    How to: Create an Action Using the Action Attribute
    How to: Customize Action Controls
    How to: Customize the Export Action Behavior
    How to: Customize the New Action's Items List
    How to: Deactivate (Hide) an Action in Code
    How to: Disable an Action When the Current View Has Unsaved Changes
    How to: Hide the Edit Action Column from a ListView in an ASP.NET Application
    How to: Initialize an Object Created Using the New Action
    How to: Limit the Amount of Objects Created using the New Action
    How to: Make the FullTextSearch Action Search Within Required Properties
    How to: Reorder an Action Container's Actions Collection
    How to: Replace a List View's Default Action
  [Expand]Navigation
  [Expand]Views
  [Expand]List Editors
  [Expand]Property Editors
  [Expand]Templates
  [Expand]Filtering
  [Expand]Reporting
  [Expand]Dashboards
  [Expand]Scheduler and Notifications
  [Expand]Maps
  [Expand]Security
  [Expand]Workflow
  [Expand]Localization
  [Expand]Testing
  [Expand]Miscellaneous UI Customizations
  Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Limit the Amount of Objects Created using the New Action

This topic describes how to limit the number of objects that an end-user can create using the New Action. Assume you are using the Task business class from the Business Class Library. When creating a new Task using the New Action, the count of existing Task objects will be checked and an end-user will not be allowed to create additional objects if there are already three objects.

Note

The approach described in this topic is not supported by the Mobile platform.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E239.

To access the Task List View when the New Action is about to create a new object, handle the NewObjectViewController.ObjectCreating event of the NewObjectViewController, which contains the New Action. To do this, implement a new View Controller and override the OnActivated method in the following manner.

Note

You can disable an Action instead of interrupting its execution. See the How to: Disable an Action When the Current View Has Unsaved Changes example.

Expanded See Also

How would you rate this topic?​​​​​​​