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
mask4mask4 

How to display data dynamically in visualforce page.

Hi,

 

How to display fieldnames and data dynamically in visualforce page. please share the solution.

 

Regards,

Mask.

hitesh90hitesh90

Hi,

 

here is the simple example for display account record dynamically to visualforce page.

 

Visualforce Page:

 

<apex:page controller="customController" >
	<apex:form >
		<apex:pageBlock title="Account Details">
			<apex:pageBlockSection title="Accounts" columns="2" >			
			<apex:repeat value="{!lstAccount}" var="acc" >
				<apex:outputField value="{!acc.Name}" />
			</apex:repeat>
			</apex:pageBlockSection>
		</apex:pageBlock>
	</apex:form>
</apex:page>

 Apex Class:

 

public class customController {
	public List<Account> lstAccount {get; set;}
	public customController() {
		lstAccount = [select id,name from Account];		
	}
}

 

 

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 benefits.

 

Thanks,

Hitesh Patel

mask4mask4

Thanks for your reply, But I want to Pulling of dynamic data by the UI and displaying in visualforce page.

Bhawani SharmaBhawani Sharma
How do you want to pull it from UI?
Nazrul AminNazrul Amin
I am also interested in this question please.  I want to run a query on records and display that information in a visualforce page.  I dont want the data to come from existing fields in records, but it to be generated by code and displayed in the UI, the data does not need to be stored either.  Thanks