Sharepoint Multiple Lookup Field : SPFieldLookupValueCollection

Field Class: SPFieldLookup
Field Value Class: SPFieldLookupValueCollection

How to use the lookup column values (through a method)?
itemValues.ForEach(Operate)      //Operate is the method name
void Operate(SPFieldLookupValue iValue) //All LookUp values are passed to function one by one

How to use the lookup column values?
SPFieldLookupValueCollection itemValues = (SPFieldLookupValueCollection) item["FieldName"];
            foreach (SPFieldLookupValue iValue in itemValues)
            {
                int nID =  iValue .LookupId;
                string strValue =  iValue .LookupValue;
            }

No comments:

Post a Comment