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
nishad basha 7nishad basha 7 

how to display account records once click query button using visualforce page?

Hi
sandeep sankhlasandeep sankhla
Hi ,

You can pass the object name to apex class and then you can use query to get all the records and then you can get all those records in a list and then you can render that list in page in below section....


Let me know if you face any diffculity in implementing this..

Thanks
Sandeep
nishad basha 7nishad basha 7
can you please send me that code
Keyur  ModiKeyur Modi
<apex:page controller="AccountController">
	<apex :form>
		<apex:commandButton value="AccountRecord" action="{!onClick}">
			<apex:pageblockTable value={!lstAccount} var="eachRecord">
				<apex:column value="eachRecord.Id">
				<apex:column value="eachRecord.Name">
			</apex:pageBlockTable>
	</apex :form>
</apex:page>

controller 

public Class AccountController{
public List<Account>lstAccount{get;set;}
	
	public AccountController(){
	lstAccount=new List<Account>();
	}

	public void onClick(){
	lstAccount=[SELECT id,Name FROM Account];
	}
}

Use this bunch of code .. still if you found difficult then let me know.