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
Rahul 168Rahul 168 

How to show contact firstname in first row and lastname in second row in salesforce. i.e Like below image

User-added image
RKSalesforceRKSalesforce
Hi Ankit,

Please use below code which is working for Accounts. make changes in code according to Contact Object.
<apex:page standardController="Account" recordSetVar="accounts" showHeader="false" 
applyHtmlTag="true"
applyBodyTag="true"
>
<table style="width:100%; border: solid black;" >
<tr style="border: solid black;">
    <th style="border: solid black;">Name:</th>
    <apex:repeat value="{!accounts}" var="ct">
    <td style=" border: solid black;">{!ct.Name}</td>
    </apex:repeat>
</tr>
<tr style="width:100%; border: solid black;">
    <th style="border: solid black;">Phone:</th>
    <apex:repeat value="{!accounts}" var="ct">
    <td style="border: solid black;">
    {!ct.Phone}
    </td>
    </apex:repeat>
  </tr>
  </table>
</apex:page>
Please mark as best answer if helped.

Regards,
Ramakant
 
Rahul 168Rahul 168
It is not the right one,what i want to do is like displaying contact record as per image given in the post.
ujwal theja 1ujwal theja 1
Hi Ankit,

Follow this vertical style. I think this will resolve your problem.

Sol:-

<table>
      
    <tr>
         <th>First Name</th>
         <td>Ankit</td><td>Brijesh</td><td>Manish</td>
    </tr>
    <tr>
         <th>Last Name</th>
         <td>Singh</td><td>Kumar</td><td>Tyagi</td>
    </tr>
    <tr>
          <th>Phone</th>
          <td>1234</td><td>1589651</td><td>4951651</td>
    </tr>
    <tr>
          <th>Email</th>
          <td>ankit@gmail.com</td><td>brijesh@gmail.com</td><td>manish@gmail.com</td>
    </tr>
</table>

Result:- 

     User-added image

Is this helpful for you?

Thanks,
Ujwal K