+ Start a Discussion
sreeesreee 

can we give numbering for retrieved records in vf page???????

can we give numbering for retrieved records in vf page???????

Can any one Explain.......Thanx in Advance

 
SFDC_LearnerSFDC_Learner

Yes.

 

Different ways we can use to do this. Few ways i shown here.

 

 

Way1:

 

Using <apex:variable/> tag we can do easily.

 

 

Page:

 

<apex:page controller="DataDisplay">
<apex:form >

<apex:pageblock >
<apex:variable value="{!rowCount}" var="i"/>
<apex:pageblocktable value="{!lstA}" var="a">
<apex:column headerValue="Sno">
<apex:variable value="{!i+1}" var="i"/>
{!i}
</apex:column>
<apex:column headerValue="Name" value="{!a.name}"/>
<apex:column headerValue="Phone" value="{!a.phone}"/>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>

 

 

class:

 

public with sharing class DataDisplay {
public Integer rowCount { get; set; }
public List<Account> lstA{get;set;}
public DataDisplay(){
rowCount =0;
lstA = new List<Account>();
lstA = [select id,name,phone from Account];
}
}

 

 

 

 

Way2:

 

we can use the wrapper class to bind the integer value for the sobject records.

sreeesreee
THx for solutions

--
*Thanks*
*srikanth*
*cell no *9620241256