1

How do you extract multiple string values in an SPlookup field?

I tried the following but it didn't work

SPFieldLookupValue LookUpValues = new SPFieldLookupValue(oPage.ListItem["TaggingKeywords"].ToString());

oRow["TaggingKeywords"] = (LookUpValues.LookupValue.ToString());

1 Answer 1

1

You should use this:

string rawvalue = item["lookupFieldname"].ToString();
SPFieldLookupValueCollection values = new SPFieldLookupValueCollection(rawvalue);
foreach(SPFieldLookupValue value in values) String.Format("{0} {1}", value.LookupValue, value.LookupId);

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.