Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We need to get all custom page names into the select box. Is there any way that we can describe all pages like objects

share|improve this question

You can query for apex pages, returning a list of selectOption instances as you would for any other custom list:

// controller
public String chosen {get; set;}

public List<SelectOption> GetPageOptions()
{
  List<SelectOption> pages = new List<SelectOption>();

  for(ApexPage p : [select Id, Name from ApexPage limit 1000])
  {
    // use the ID as a value, the page name as a label
    pages.add(new SelectOption(p.Id, p.Name));
  }

  return pages;
}

// page
<apex:selectList value="{!chosen}">
  <apex:selectOptions value="{!PageOptions}"/>
</apex:selectList>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.