By default, getSelectedValue method is used to retrieve the items value that are selected in the DropDownList. It returns the item value in the “string” data type instead of corresponding data type of the item.
But, using itemValue property, we can get the selected items as it is. But the “itemValue” property is only applicable for Single Selection mode in the DropDownList.
In the following example, upon selecting the items in the DropDownList, the change event will be triggered. In the change event, itemValue will returns the selected value in the DropDownList and the returned value will be in its corresponding data type.
For reference, we have added the local method called “toType” which receives the selected value from the DropDownList and returns the data type of the value.
Please refer the following code snippet.
This page will automatically be redirected to the sign-in page in 10 seconds.