Empty dropdown value for kentico fields

In kentico you are probably using a lot of custom-tables and/or page-types. When creating the fields you might want to user to pick just a value from a dropdownlist. In that case you can use “DropDownlist” as form control and fill some options into “List of options”. But what if the field is optional, in that case you don’t want to force the user to pick a value. You could create a “Empty” option of course but i think this trick is, in my opinion, a bit cleaner:

Switch to “Sql Query” and use the following:

select ”, ‘– optional: select a option –‘
select ‘Value1’, ‘DisplayValue’


In that way the value for the field will still be NULL when nothing is selected! I’m using this a lot with Enum values defined in the backend!

August 16, 2016

Leave A Reply

You must be logged in to post a comment.