FieldSortParams element (View)

Applies to: SharePoint 2016 | SharePoint Foundation 2013 | SharePoint Online | SharePoint Server 2013

Returns the sort direction on a list, rendering Asc or Desc based on whether the field has been sorted and on the current default sort direction for the field. Rendering of this field is conditional and depends on the current sorting URL sent in the request to the server.

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

Elements and attributes

The following sections describe attributes, child elements, and parent elements.

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.
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 example creates a default URL for a sort on a list. The FieldSortParams element is used to return the sort direction, which is assigned to the SORTINGFIELDS attribute in the resulting <A> tag.

<Default>
   <HTML><![CDATA[<A ID="diidSort]]></HTML>
   <Property Select='Name'/>
   <HTML><![CDATA[" TITLE=]]></HTML>
   <HTML>"Sort by </HTML>
   <Property Select='DisplayName' HTMLEncode='TRUE'/>
   <HTML><![CDATA[" SORTINGFIELDS="]]></HTML>
   <FieldSortParams/>
   <HTML><![CDATA[" HREF="javascript:"
      OnClick='javascript:SubmitFormPost("]]></HTML>
   <ScriptQuote NotAddingQuote="TRUE">
      <PageUrl/>
      <HTML><![CDATA[?]]></HTML>
      <FieldSortParams/>
   </ScriptQuote>
   <HTML><![CDATA[");javascript:return false;'>]]></HTML>
   <Property Select='DisplayName' HTMLEncode="TRUE"/>
   <HTML><![CDATA[</A><IMG SRC="]]></HTML>
   <FieldSortImageURL/>
   <HTML><![CDATA[" ALT=]]></HTML>
   <Switch>
      <Expr>
         <GetVar Name='SortDir'/>
      </Expr>
      <Case Value='Asc'>
         <HTML>"Sort Ascending"</HTML>
      </Case>
      <Case Value='Desc'>
         <HTML>"Sort Descending"</HTML>
      </Case>
      <Default>
         <HTML>""</HTML>
      </Default>
   </Switch>
   <HTML><![CDATA[ BORDER=0>]]></HTML>
</Default>

See also