Hello all,
I am having an issue binding the selected value of a choice set to be the default value of a drop down control.
I have an application which contains a table to display data, another page to search that data, and another page to edit that data. For the purposes of this question, lets say the data service entity I am using is named products and has two fields: productId and ProductCategory. Product category is a choice set that can be set to either “TypeOne”, “TypeTwo”, or “TypeThree”.
On the search page, users are able to search by product id. Once a product id is found, they can click an edit button that will open the edit page. In the event tab of the edit button, logic will take the value that is in the product id search field and assign it to a variable of “CurId” before launching the edit page. Once the edit page is open, a load event will query the data service and assign “SignleEntityContainer” (of type Products which is the name of my data entity) based on CurId matching the ProductId assigned on the previous page. The issue I am having is then trying to display the existing data for the productCategory field in a drop down containing the choice set options. I was able to bind the choice set options to the list source with “GetChoiceSet(“ProductCategories”)” and that works great. But when I try to get the existing product category assigned to this productId in the data service I run into issues.
In the default selected value field I have “GetChoiceSetValue(“ProductCategories”, SingleEntityContainer.ProductCategory.Value)” which I would expect to return the selected item. But instead, I get an error of "Value of type ‘String’ cannot be convert to ‘ChoiceSet’.
Any thoughts on how I can bind the default value of the data to this drop down? Thanks in advance!