String Dictionary

This component renders a dropdown list that is populated as the user types in it. The results are bound to a Dictionary specified in the field definition so only words from that dictionary will appear if they are similar what the user is typing.

String Dictionary user control, allowing users to enter or select an option from the drop-down

When the Allow Update field is set to Yes in the field definition a button will appear allowing the user to add new items directly to the dictionary.

String dictionary user control where the user is allowed to add a term to the dictionary

For Example, you may have a string dictionary field and in its field definition you select a dictionary that contains different countries. If the users input matches part of the name of a country, it will appear as a suggestion.

String Dictionary user control once the user has started to type, displaying words that begin with the letters that have already been entered

Component Code

The code section of the component begins with the standard parameters followed by the variables used for the component. Next are the methods which are detailed below.

OnParametersSetAsync()

This method is called when the component initializes and when there’s an update to the parent component. Its purpose is to assign values to the components variables.

ReadComboBox(ComboBoxReadEventArgs args)

This method is used to pull the user input from the combobox and pass it into a call to the ExecuteFilteredProcedure method.

Following that call the combo boxes Data property is assigned and is displayed in the combo box.

ExecuteFilteredProcedure(string filter)

This method is used to call the ListDictionaryOnDemand stored procedure which will return data that will be added to the dropdown list.

ValueChanged()

This method is called every time the users input in the combobox changes. Its purpose is to determine if the field is modifiable and if so, determine the visibility of the Add to dictionary button and call the ChangeXML method and generate and save new XML.

ChangeXML()

This method is called by the ValueChanged method. Its sole purpose is to build XML and call the ChangeField method on MyInstane and pass the generated XML to it.

Below is an example of the XML structure that will be saved.

<StringDictField GUID="00000000-0000-0000-0000-000000000000">Canada</StringDictField>

AddToDictionary()

This method is called when the Add to dictionary button is selected. Its purpose is to take the input from the user, validate it, and add it to the dictionary.

Updated on February 22, 2023

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support

Leave a Comment