1
<apex:commandLink value="ADD" onclick="return divToggle('{!oplist.lineNumber}');"/>

I want to apply if else condition ,if UnitPrice is not null then View commandlink should show otherwise Add should show..

  • 2
    If the links have the same action, <apex:commandLink value="{!If(oplist.UnitPrice <> null, 'VIEW', 'ADD')}" onclick="return divToggle('{!oplist.lineNumber}');"/> if actions are different then two different links as rao has proposed. – techtrekker Nov 21 '12 at 1:30
4

If I follow you right you need to display a command link when unitprice is not null. If thats the case try

updated:

<apex:page standardController="account">
<apex:form >
<apex:commandLink value="ADD" rendered="{!NOT(ISNULL(account.name))}"/>
<apex:commandLink value="View command link" rendered="{!(ISNULL(account.name))}"/>
</apex:form>
</apex:page>

replace the account.name with your unitprice

rendered attribute allows you to control the visibility conditionally on a command link

|improve this answer|||||
  • but i also need to show View command link..based on this... – Mik Nov 21 '12 at 0:42
  • thanks for replying...actually its showing an error...Incorrect number of parameters for function 'IF()'. Expected 3, received 1 – Mik Nov 21 '12 at 0:53
  • I have updated the code check it out!! Hope this helps – Rao Nov 21 '12 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.