Custom Field Uni Selector
Kentico functionalities are always inspirational.
Knowing that Kentico Uni Selector field is very versatile, we planned to use it for a custom mapping between a Kentico Item and an external DB item.
By default, Uni Selector works only with Kentico objects, as it leverages Kentico DataQuery.
Our custom Uni Selector needs to consume a service and load a list of objects from the external DB.
What needs to be done?
- Create a Kentico Custom form control in Forms Control application
- Define some custom properties to dynamically service url and object type
- Duplicate all Uni Selector Field code files into your custom folder under CMSFormControls
- Because Uni Selector use Kentico custom field cms:UniGrid that must be set up with a Kentico valid type, and we were in a hurry we have set it up to work with CMS.Category objects…though these will be replaced by the objects that will come from the web service.
- In SelectionDialog user control, we needed to change the method that loads UniGrid data
- In the user control defined for our custom form field, we needed to change GetResultData
- One last thing that we did to work perfectly was to remove hash validation from DataSelector aspx page.