SPListItem: Get the Display-Value of a lookup field

Short HowTo about getting the Display-Value of a SharePoint 2010 lookup field

03 January 2011
Christoph Keller Christoph Keller

To get the configured Display Value of a Field in a SPListItem, use the following Code:

new SPFieldLookupValue(SelectedListItem["FIELDNAME"] as String).LookupValue

Another way would be:

SelectedListItem.GetFormattedValue("FIELDNAME")

The second snipped displays also a hyperlink to item in the lookup table (surely it must be a lookup field, otherwise just the value will be displayed).


comments powered by Disqus