I'm trying to do a bit of UI Model work where I programatically populate a simple datalist field in a collection.
I've got it working for a search list field using this code:
UNCOneQueryInstanceCriteriaEditFormGIVINGDESIGNATIONSUIModel newobj = this.GIVING_DESIGNATIONS.Value.AddNew();
newobj.VALUE.Value = (Guid)reader["ID"];
newobj.VALUE.UpdateDisplayText();
But I am not sure how to get it to work for a Simple Data List field.
UNCOneQueryInstanceCriteriaEditFormSPECIALCODESUIModel newobj = this.SPECIALCODES.Value.AddNew();
newobj.VALUE.Value = reader["SPECIALCODE"].ToString() + " - " + reader["DESCRIPTION"].ToString();
newobj.VALUE.UpdateDisplayText();
I've tried a couple different iterations of that second line but to no avail... it's expecting a string... this last one passes in the value string the same way the simple data list returns the items appear in the label. I also tried passing in the ID (after converting it to a string) but that didn't work either.
I suspect it's because the dropdown list needs to be loaded first but .. I'm just not sure how to do that.