Thursday, July 14, 2011

Variable Tag on Visualforce Page for Sequence No

Hi , Mostly we avoid this variable tag on visualforce , this is very importance to create sequencing on visualforce page if we are restricted to write the apex script.
<apex:page standardcontroller="Contact" recordSetVar="Con">
<apex:sectionHeader title="All Contact With Serial Number"/>
 <apex:form >
     <table>
         <tr>
             <td>
                    <apex:variable var="call" value="{!0}" />
                        <apex:repeat var="C" value="{!Con}">
                            <tr>
                                <td><apex:variable var="call" value="{!call+1}"/>
                                    <apex:outputText value="{!call}"/>
                                </td>
                                <td>
                                    {!C.Name}
                                </td>
                                <td>
                                    {!C.Email}
                                </td>
                                <td>
                                    {!C.Phone}
                                </td>
                                <td>
                                    {!C.Account.Name}
                                </td>                                             
                            </tr>                                                  
                    </apex:repeat>             
             </td>
         </tr>
     </table>
</apex:form>

</apex:page>

1 comment: