Thursday, August 2, 2012

Get selected Lookup field value in SharePoint 2010

SPFieldLookup myField = myItem[i].Fields["LookupFieldName"] as SPFieldLookup;

SPFieldLookupValue myLookupValue = myField.GetFieldValue(myItem[i]["LookupFieldName"].ToString()) as SPFieldLookupValue;

string LookupFieldValue = myLookupValue.LookupValue;