Error Message Customization

Custom Error Message on Adding Record

Code Customization
Custom Error Message on Adding Record

This customization displays a custom error message when adding a record with a duplicate primary key.

This customization overrides the Validate() method and checks to see if a duplicate record exists. If the record exists, an exception is thrown to display the custom error message.

When an exception is thrown in the Validate() method, it is caught in the SaveButton_Click handler. The SaveButton_Click handler calls RegisterJScriptAlert to display the error message to the user. Throwing an exception ensures that the record will not be saved. The record is saved if an exception is not thrown.

For a Web Application the customization will be added in:

..\<Application Name>\<Table Name>\Add<Table Name>.Controls.cs

For example: C:\MyApp1\Customers\AddCustomers.Controls.cs

For a Web Site the customization will be added in:

..\<Application Name>\App_Code\<Table Name>\Add<Table Name>.Controls.cs

For example: C:\MyApp1\App_Code\Customers\AddCustomers.Controls.cs


Step 1:  Use this wizard to add code customization.

Step 2:  Build and run the application.

Applies To:

This customization only applies to Add Record pages and database tables whose primary keys are not autogenerated.

This customization only applies to tables with non-composite primary key.

Customizations included in this wizard are provided as a sample to demonstrate a feature, and may work only in specific situations. The Iron Speed Designer support team cannot assist in the resolution of problems which may occur as a result of customizing your application or modifying a customization to fit a particular purpose.

Terms of Service Privacy Statement