function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nani@408Nani@408 

Display Accounts

Hai,

        iam new to development.. Help me

 

      How to Dispaly All Account Names Row Wise on VF Page(per row only 5 Names)

 

Thanks in Advance.

Nani.

Navatar_DbSupNavatar_DbSup

Hi,

Try the below code snippet as reference:

 

------------ apex class --------------

public class test_cls

{

    public List<string> finalacc{set;get;}

 

public test_cls()

{

finalacc=new List<String>();

List <Account> acc =[select id,name from account];

integer count=0;

for(integer i=0;i<acc.size();i++)

{

    if(MAth.Mod(count,5)==0 && count!=0)

    {

    string accname=acc[i].name +'<br/>';

   

    finalacc.add(accname);

    }

    else

    {

    finalacc.add(acc[i].name);

    }

    count++;

}

 

}

}

-------- vf page --------------

<apex:page controller="test_cls" >

<apex:form >

<apex:outputText escape="false" value="{!finalacc}">

 

</apex:outputText>

</apex:form>

</apex:page>

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

Nani@408Nani@408

Thanks Navatar for ur reply