Quantcast
Viewing all articles
Browse latest Browse all 7205

How to dynamically change mask settings based on the current object

Scenario:

It is necessary to change mask settings of a certain editor dynamically, e.g. based on properties of the current object.

Steps to implement:

There are two ways to implement this functionality:

1. Implement a ViewController that handles the current View's events and changes settings of the required editors, as shown in the Access Editor Settings topic.

2. Implement a custom Property Editor (e.g. a descendant of the corresponding built-in property editor) and change settings of its control. Refer to the Implement Custom Property Editors topics for additional information.

In this example, the first approach is demonstrated. To implement it, the following classes are added:

DemoObject - a persistent class with the TestString and Mask properties. Mask settings of the TestString property are changed based on the Mask property value;
ChangeMaskControllerBase - a platform-independent controller that handles events required for updating mask settings at an appropriate moment;
WinChangeMaskController - a WinForms-specific controller that customizes settings of a WinForms control;
WebChangeMaskController - an ASP.NET-specific controller that customizes settings of an ASP.NET control.

Note that these approaches can be used only for detail views. To implement the same functionality in a ListView, create a ViewController for it and customize its List Editor according to specifics of the List Editor's control (see Access Grid Control Properties).

See also:
Mask Editors Overview (WinForms)
Mask Editing (ASP.NET)


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>