Thursday, 25 September 2014

PageBlockSections with different colors at each section.





Hi friends,

Few days ago, one of my client come up with this requirement,

He wants to see all sections on the detail page in different color so that he can easily differentiate (or group) fields of the custom object according to color code like red section fields blue section fields,

Generally each section on the detail page has the same color as their tab,


so for this requirement i have created a vf page and put that page in the detail page layout,

I am using FieldSet here so that we can easily add and remove fields from vf page later without touching code of vf page.

Note:-
Before using this code must create FieldSet, for creating FieldSet go to your custom object and select new FieldSet.(for more detail see this link).

Here i am using three FieldSets name as
  1. FieldSet1
  2. FieldSet2
  3. FieldSet3
Here the code of that vf page:-



Screen Shots:-


Happy coding..:)
Thanks,
Anurag Jain

4 comments: