VisualForce Row Count

This is my first tutorial on VisualForce – a markup language for

The scenario was I needed to display a numbering for each child record found on the master record without coding an extension or using a controller.

My solution. Code below would loop to the child records and display each result found. The number count is declare as a variable with a value that starts at 1 before the start of the repeat tag and then another variable tag declaring using the same variable, using the formula VALUE before the end of the repeat to initialize it from text to a number integer then incrementing it by one.

<apex:variable value=”1″ var=”rowNum”/>
<apex:repeat value=”{!Work_Order__c.Work_Order_Charges__r}” var=”List” id=”theRepeat”>
<td><apex:outputtext value=”{!rowNum}”/></td>
<apex:variable var=”rowNum” value=”{!VALUE(rowNum) + 1}”/>