共用方式為


Column2 Element (View)

Applies to: SharePoint Foundation 2010

Used in rendering a hyperlink. In Microsoft SharePoint Foundation, hyperlinks are stored as two separate values. The actual URL value is stored as one value, and the descriptive text is stored as the other. In a Link field, <Column/> returns the value of the URL, and <Column2/> returns the descriptive text of the hyperlink.

<Column2
  AutoHyperLink = "TRUE" | "FALSE"
  AutoHyperLinkNoEncoding = "TRUE" | "FALSE"
  AutoNewLine = "TRUE" | "FALSE"
  Default = "Text"
  ExpandXML = "TRUE" | "FALSE"
  HTMLEncode = "TRUE" | "FALSE"
  Name = "Text"
  ShowField = "Text"
  StripWS = "TRUE" | "FALSE"
  URLEncode = "TRUE" | "FALSE"
  URLEncodeAsURL = "TRUE" | "FALSE">
</Column2>

Attributes

Attribute

Description

AutoHyperLink

Optional Boolean. TRUE to surround text with <A> tags if the text appears like a hyperlink (for example, www.microsoft.com).

AutoHyperLinkNoEncoding

Optional Boolean. TRUE to surround text with <A> tags if the text appears like a hyperlink (for example, www.microsoft.com) but without HTML encoding.

AutoNewLine

Optional Boolean. TRUE to insert <BR> tags into the text stream and to replace multiple spaces with a nonbreaking space (&nbsp;).

Default

Optional Text. Renders the text assigned to this attribute if the value returned by a selection is an empty string ("").

ExpandXML

Optional Boolean. TRUE to re-pass the rendered content through the Collaborative Application Markup Language (CAML) interpreter, which allows CAML to render CAML.

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.

Name

Optional Text. Allows the Column element to be used outside the field rendering context by supplying an ID (for example, <Column Name="ID"/>).

ShowField

Optional Text. The ShowField attribute can be set to the column name to display. By default, a hyperlinked text from the Title column of the record in the external list is displayed. But the ShowField attribute can be used to override that and display another field from the external list.

The following data types are allowed as targets of a ShowField attribute: Text, Choice, and Counter.

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 so that forward slashes ("/") are not encoded.

Child Elements

None

Parent Elements

Numerous

Occurrences

Minimum: 0

Maximum: Unbounded

Example

The following Switch statement evaluates the Column2 value and, if it is empty, sets the HTML encoding of the Column element value (in other words, of the URL) to TRUE. Otherwise, it sets the HTML encoding of the URL's descriptive text to TRUE.

<Switch>
  <Expr>
    <Column2/>
  </Expr>
  <Case Value="">
    <Column HTMLEncode="TRUE"/>
  </Case>
  <Default>
    <Column2 HTMLEncode="TRUE"/>
  </Default>
</Switch>

See Also

Reference

Column Element (View)