locked
XSL statements in DVWP, that hides column value based on current user RRS feed

  • Question

  • I have this column on a Dataview webpart,  i need to check first if the current user is the value of a HiringManager column, if yes, then it will display the value of the Confidential column, if not, it will hide the value of the column. can you help me fix this code. thanks.

    <!--Confidential-->
    <!--Confidential-->
    <TD Class="{$IDAJAIVH}">
     <xsl:if test="@HiringManager=[Me]">
      <xsl:value-of disable-output-escaping="yes" select="ddwrt:AutoNewLine(string(@Confidential))">
      </xsl:value-of>
     </xsl:if>
    </TD>


    cal_bonjovi

    • Moved by Emir Liu Tuesday, June 25, 2013 2:35 AM
    Monday, June 24, 2013 3:51 AM

Answers

  • Hi cal,

    Here is the resolution for you.

    1. Add a parameter to the data view web part first. We can get current login user with following parameter.
      Name: Param1
      Parameter Source: Server Variable
      Server Variable Name: LOGON_USER
    2. Modify the XSLT to following.

     <xsl:if test="@HiringManager=substring-after($Param1,’\’)">
      <xsl:value-of disable-output-escaping="yes" select="ddwrt:AutoNewLine(string(@Confidential))">
      </xsl:value-of>

               3. If HiringManager is a user type of field, change it to @HiringManager.title

    Thanks & Regards,
    Emir Liu
    TechNet Subscriber Support in forum
    If you have any feedback on our support, please click here.


    Emir Liu
    TechNet Community Support

    Tuesday, June 25, 2013 2:34 AM