Take the 2-minute tour ×
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.

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
add comment

1 Answer

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
add comment

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.