Partager via


Column Element

The Column element is used to return the raw data value for a particular field (as opposed to the formatted version provided by the Field element). In the case of a Lookup field, Column returns the local value (an ID number in the list that references another list), while the LookupColumn element returns the data from the foreign table.

Syntax

<Column
  AutoHyperLink = "TRUE" | "FALSE"
  AutoNewLine = "TRUE" | "FALSE"
  Default = "Text"
  Format="DateTime"
  HTMLEncode = "TRUE" | "FALSE"
  Name = "Text"
  StripWS = "TRUE" | "FALSE"
  URLEncode = "TRUE" | "FALSE"
  URLEncodeAsURL = "TRUE" | "FALSE">
</Column>

Attributes

Name 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 ("").
Format Optional Text. Controls the date formatting for date fields. Supported formats include DateTime, DateOnly, TimeOnly, ISO8601, ISO8601Basic, and ISO8601Gregorian.
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"/>).
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.

Remarks

Note that using an empty Column element (<Column/>) is sensitive to the current setting of the DisplayMode variable. The display mode is set implicitly according to the current command being used. If a view or item is being displayed, DisplayMode is set to Display. If an item is being created from a form, DisplayMode is set to New. If an existing item is being edited, DisplayMode is set to Edit. The DisplayMode variable can be overridden in the page by setting it directly, for example, <SetVar Name="DisplayMode">Edit</SetVar>.

Using <Column/> to render a date field or a number field will render the data in the locale of the server because <Column/> renders numeric values according to the locale-specific rules of the server.

Example

The following example evaluates the FreeForm variable to determine how to render a value in a field. If the variable is set to TRUE, the value is placed freeform; otherwise, the value is right-aligned.

<RenderPattern Name="DisplayPattern" DisplayName="DisplayPattern">
  <Switch>
    <Expr>
      <GetVar Name="FreeForm"/>
    </Expr>
    <Case Value="TRUE">
      <Column/>
    </Case>
    <Default>
      <HTML>
        <![CDATA[ <DIV ALIGN=RIGHT> ]]>
      </HTML>
      <Column/>
      <HTML>
        <![CDATA[ </DIV> ]]>
      </HTML>
    </Default>
  </Switch>
</RenderPattern>