0

I have a droplist field in Item. Its source is of a folder where 2 items present named Yes and No. When the droplist field is clicked 2 options comes up. I want to edit the field through Code i am doing below:

sampleItem.Editing.BeginEdit();

sampleItem.Fields["DroplIst Field Name"].Value = "Value to be saved in droplist";

sampleItem.Editing.EndEdit();

It updates the field , But when I try saving the Item it throws error as "The field contains a value that is not in the selection list.". How can i select the item from selection list through Code?

| improve this question | | | | |
0

I think, your issue is similar to this article.

https://stackoverflow.com/questions/33255922/sitecore-the-field-contains-a-value-that-is-not-in-the-selection-list

If you can use DropLink, instead of DropList, then it will update the value, as it maintains the ID of that target item.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.