+ Start a Discussion
ishaan.dilip.motwaniishaan.dilip.motwani 

How to highlight a page block section based on a field value ?

Suppose I have multiple page block sections on my VF page created for Account object.

I want a solution to highlight a particular page block section based on a particular field value.

 

( Please Note :

I am aware of rendering a page block section based in a field value.

All I need is to highlight it based on a field value.

)

 

 

Thanks in advance,

Ishaan

nwallacenwallace

The easiest way I can think of is this:  wrap the pageBlockSection in an outputPanel and give the outputPanel a styleClass attribute that you use to highlight the section.

 

Page:

    <apex:outputPanel styleClass="{!stylingFieldInController}">

        <apex:pageBlockSection ... styleClass="{!}"> ... </apex:pageBlockSection>

    </apex:outputPanel>

 

Controller:

    public String stylingFieldInController {get; set { stylingFieldInController = 'myStyleClass' } }

 

CSS:

    .myStyleClass { background-color: yellow; }