LookupColumn element (View)
Applies to: SharePoint 2016 | SharePoint Foundation 2013 | SharePoint Online | SharePoint Server 2013
Functions similarly to the Column element but only valid when referring to a Lookup field. The only distinction between the Column and LookupColumn elements for Lookup fields is that LookupColumn retrieves the raw value of the column from the foreign list, while Column retrieves the raw value of the column in the local list.
<LookupColumn
HTMLEncode = "TRUE" | "FALSE" IncludeVersions = "TRUE" | "FALSE"
Name = "Text"
ShowField = "Text"
StripWS = "TRUE" | "FALSE"
URLEncode = "TRUE" | "FALSE"
URLEncodeAsURL = "TRUE" | "FALSE">
</LookupColumn>
Elements and attributes
The following sections describe attributes, child elements, and parent elements.
Attributes
Attribute | Description |
---|---|
HTMLEncode |
Optional Boolean. TRUE to convert embedded characters so that they are displayed as text in the browser. In other words, characters that could be confused with HTML tags are converted to entities. |
IncludeVersions |
Optional Boolean. |
Name |
Required Text. Specifies the name of the lookup column. Allows the LookupColumn element to be used outside the field rendering context by supplying an ID. |
ShowField |
Optional Text. Specifies the field to be displayed in the list that is referenced through the Lookup field. If this attribute is not specified, the default is to display the value contained in the Title field. |
StripWS |
Optional Boolean. TRUE to remove white space from the beginning and end of the value returned by the element. |
URLEncode |
Optional Boolean. TRUE to convert special characters, such as spaces, to quoted UTF-8 format, for example, %c3%ab for character ë . |
URLEncodeAsURL |
Optional Boolean. Like URLEncode, but TRUE to specify that the string to encode is a path component of a URL and not to encode the forward slash (/ ). |
Child elements
None
Parent elements
Numerous
Occurrences
- Minimum: 0
- Maximum: Unbounded (1 within Expr1, Expr2, and UrlBaseName)
Remarks
In the case of a Lookup field called LookupTitle that points to the title of item 1 in an announcements list, <LookupColumn Name="LookupTitle"/>
would render "Get Started with SharePoint Foundation!", while <Column Name="LookupTitle"/>
would render "1".
Consequently, in most situations involving Lookup fields, use the LookupColumn element instead of the Column element. The only time to use the Column element is when you need a raw reference to the ID of the item in the target list, perhaps for constructing your own link to the target item.
Example
The following example uses the LookupColumn element to return a value that is used in creating a complete URL for a page on the server.
<HTML><![CDATA[ <a href=" ]]></HTML>
<HttpHost URLEncodeAsURL="TRUE" />
<LookupColumn URLEncodeAsURL="TRUE" />
<HTML><![CDATA[ "> ]]></HTML>