Mappings Wizards
- 3 minutes to read
The task of establishing mappings between the fields in a data table and appointment’s properties is tedious, and may cause obscure application errors due to typos in field names or incorrect relations. Mappings Wizards help you create mappings with minimal hassle, and in less time.
Mappings Wizards are available at design-time if the Scheduler control is bound to the System.Web.UI.WebControls.SqlDataSource or the System.Web.UI.WebControls.AccessDataSource data controls.
The ASPxScheduler control provides two wizards - one to map appointment fields, and another for resources. The wizards can be invoked by clicking the control’s smart tag (as illustrated in the picture) or via the ellipsis button of the Mappings item in a Storage-Appointments or Storage-Resources branch in the property pages.
Click the Generate button. The built-in algorithm attempts to guess which field matches a particular appointment property. In most cases the resulting mappings are correct, although you are strongly advised to check the mappings to avoid mistakes. You can clear all mappings, generate them as suggested by the Wizard and modify them if needed, by selecting fields in the drop-downs. After you click Next, the Wizard validates mappings and displays a diagnostic message.
The second page of the Wizard allows you to create mappings for custom fields, i.e., fields that are not included in a standard appointment (resource) property set. Note that the establishment of a custom mapping does not result in modifications being made in an appointment editing form or elsewhere - it’s up to you to manage these fields.
The third page of the Appointment Wizard addresses the synchronization of the appointment ID for the newly created or updated appointment. The check box represents the ASPxAppointmentStorage.AutoRetrieveId property. It is valid for the SqlDataSource, the AccessDataSource and the ObjectDataSource controls. For other data source types, it is ignored.
When all settings are done, you can use the built-in capabilities of the Wizards to validate mappings. Click the Check Mappings smart tag to get either the enthusiastic “Mappings are correct!” message or a more descriptive one, as illustrated below:
This diagnostic message informs you that:
- The mapping for the mandatory property Start is not specified.
- There are two properties (AppointmentId, ResourceId) mapped to the same data field (UniqueID), which is not allowed.
Note that incorrect mappings may lead to errors that are difficult to diagnose, so be sure to double check them. Review the Data Table Structure topic for data type requirements.
Note
If you use a ObjectDataSource in your project, you should manually set mappings in code behind. By design, the Mappings Wizard does not get properties from ObjectDataSource objects.