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
downloadingdownloading 

Get the Values from Controller

Hi,

 

I wanna get the value from Controller and Display them on my apexPage,

Could anyone help me with the Sample Code , how to achieve this..

 

thankyou

 

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

 

Try the below code as reference:

 


Public class TestData
{
Public list<contact> con{get;set;}
Public TestData()
{
con=[select id ,lastname from contact limit 10];
}
}
//////////////////// VF Page /////////////////////
<apex:page controller="TestData">
<apex:pageBlock >
<apex:pageBlockTable value="{!con}" var="c">
<apex:column value="{!c.id}"/>
<apex:column value="{!c.lastname}"/>
</apex:pageBlockTable>
</apex:pageBlock>

</apex:page>

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

 

Try the below code as reference:

 


Public class TestData
{
Public list<contact> con{get;set;}
Public TestData()
{
con=[select id ,lastname from contact limit 10];
}
}
//////////////////// VF Page /////////////////////
<apex:page controller="TestData">
<apex:pageBlock >
<apex:pageBlockTable value="{!con}" var="c">
<apex:column value="{!c.id}"/>
<apex:column value="{!c.lastname}"/>
</apex:pageBlockTable>
</apex:pageBlock>

</apex:page>

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

This was selected as the best answer
Chamil MadusankaChamil Madusanka

What type of value, you want to display?

 

List of object can be display using pageblocktable,datatable or repeat

 

Refer : http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_pageBlockTable.htm

             http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_repeat.htm

             http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_dataTable.htm

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.