Share via


IfEqual Element (View)

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Allows for conditional rendering based on the comparison of two Collaborative Application Markup Language (CAML) expressions.

<IfEqual>
</IfEqual>

Attributes

Attribute

Description

None

N/A

Child Elements

Else, Expr1, Expr2, Then

Parent Elements

Numerous

Example

The following example uses the IfEqual element to define the display pattern for the Checked Out To column. If the user ID equals null, nothing is displayed. If the user ID does not equal null, a link is provided to a display form with information about the user.

<DisplayPattern>
   <IfEqual>
      <Expr1>
         <Field Name="CheckedOutUserId" />
      </Expr1>
      <Expr2 />
      <Then />
      <Else>
         <HTML><![CDATA[ <a href="]]></HTML>
         <HttpVDir/>
         <HTML>
            <![CDATA[ /_layouts/[%=System.Threading.Thread.
               CurrentThread.CurrentUICulture.LCID%]/UserDisp.aspx?ID=
            ]]></HTML>
         <Field Name="CheckedOutUserId" />
         <HTML><![CDATA[ ">]]></HTML>
         <Field HTMLEncode="TRUE" Name="CheckedOutTitle" />
         <HTML><![CDATA[ </a>]]></HTML>
      </Else>
   </IfEqual>
</DisplayPattern>

See Also

Reference

IfNew Element (View)