Hi Raghav,
Below is the code for apex controller :
public class AccountNameDemo {
Public List<Account> listOfAccounts{get;set;}
public boolean showAccount{get;set;}
public AccountNameDemo(){
listOfAccounts = new List<Account>();
showAccount = false;
}
public void AccountList(){
listOfAccounts = [select id,name from Account limit 50000];
showAccount = true;
}
}
here is the code for visualforce page :
<apex:page controller=”AccountNameDemo”>
<apex:form>
<apex:commandButton action=”{!AccountList}” value=”AccountsName” id=”theButton”/>
<apex:repeat value=”{!listofAccounts}” var=”acc” rendered=”{!showAccount}”>
<apex:outputText value=”{!acc.name}”></apex:outputText>
<br/>
</apex:repeat>
</apex:form>
</apex:page>
below is the screen shot of output :
