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
ahmadkhanahmadkhan 

Displaying Field Values in VF Page

Hi guys

 

i have three lists of different objects in my controller and i have to retrieve values from that lists and display it in VF page which is rendered as pdf.

 

but when i try to use dataTable or PageBlockSection it doesnot show anyvalue and when i use <apex:repeat> then it displays value but for two times i know because repeat works like for loop for display records but how i can display the field values can anyone please tell me exact sytnax? i am using the following code now but its not showing

<apex:dataTable value="{!accounts}" var="a">

<tr>
<td>ROC No. <span class="wrapper" style="padding: -1px 0 0 90px; border:solid #000 1px;"><input type="text" style="height:20px;" size="10" />{!a.ROC_No__c}</span>JKKP Reg. No.<span class="wrapper" style="padding: 4px 0 0 72px; border:solid #000 1px;"><input type="text" style="height:15px;" size="20"/></span></td>
<td style="background-color:#cecece;"></td>
<td rowspan="4"></td>
</tr>

</apex:dataTable>

 

Please Help!

Neeraj_ChauriyaNeeraj_Chauriya

Hi ahmadkhan,

 

<apex:datatable> itself is rendered as html table, so no need to explicitely specifying <tr><td> inside the <apex:datatable> tag.

 

dataTable example:

<apex:dataTable value="{!accounts}" var="a">
    <apex:column headerValue="ROC No" value="{!a.ROC_No__c}"/>
    <apex:column headerValue="Header" value="{!a.FIELD_NAME}"/>
</apex:dataTable>

 
If you want to use <apex:repeat> then example would be:

<table>
    <tr>
        <th><apex:outputText value="ROC No"/></th>
        <th><apex:outputText value="Header"/></th>
    </tr>
    <apex:repeat value="{!accounts}" var="a">
        <tr>
            <td><apex:outputText value="{!a.ROC_No__c}"/></td>
            <td><apex:outputText value="{!a.FIELD_NAME}"/></td>
        </tr>
    </apex:repeat>
</table>

 


You can find details for syntax in standard component reference:
http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_dataTable.htm

 

 

Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other's benefit.

SFDC_LearnerSFDC_Learner

It should be like below:

 

<table border="1">
<tr>
<td>
Account Name
</td>
<td>
Contact Name
</td>
</tr>
<apex:repeat value="{!lstWD}" var="w">
<tr>
<td>
{!w.objA.Name}
</td>
<td>
{!w.objC.Name}
</td>
</tr>
</apex:repeat>