0

I have coded a visualforce email template with messaging:htmlEmailBody. But I want to hide complete row in my table if field value is null. `

        <p>Dear {!relatedTo.FirstName} {!relatedTo.LastName},</p>
        <p>We have received NMIMS Application Fees.</p>
        <p>Details for Program selected are as below : </p>
        <table border="0" >

            <apex:repeat var="Lds" value="{!relatedTo}">
            <tr>
                <td>Academic Background: </td>
                <td>{!Lds.NMAT_Academic_Background__c}</td>                 
            </tr>
            <tr>
                <td>Program Category: </td>
                <td>{!Lds.NMAT_Program_Category__c}</td>                 
            </tr>
            <tr>
                <td> Program Preferences 1: </td>
                <td>{!Lds.Program_Preference_1__c}</td>                 
            </tr>

            </apex:repeat> 
        </table>

      <p>Regards 
      NMIMS</p>

        </body>
    </html>

`

In this code i want to hide 3rd row if value of {!Lds.Program_Preference_1__c} is Null else show that row.

Thanks for help:)

1 Answer 1

2

You can try to wrap your third row in <apex:outputPanel/> with layout set to none and rendered according your conditions.

For example:

    <apex:repeat var="Lds" value="{!relatedTo}">
        <tr>
            <td>Academic Background: </td>
            <td>{!Lds.NMAT_Academic_Background__c}</td>                 
        </tr>
        <tr>
            <td>Program Category: </td>
            <td>{!Lds.NMAT_Program_Category__c}</td>                 
        </tr>
        <!-- logic to hide third row: layout none is used to ensure that no extra div/span tag generated-->
        <apex:outputPanel layout="none" rendered="{!NOT(ISNULL(Lds.Program_Preference_1__c))}">
            <tr>
                <td> Program Preferences 1: </td>
                <td>{!Lds.Program_Preference_1__c}</td>                 
            </tr>
        </apex:outputPanel>
    </apex:repeat> 
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .