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
S SaiS Sai 

In visualforce page display the search record details

Hi all,

please find the image when i am clicking the search button then display the serched number records in visualforce page please helpUser-added image
Swaraj Behera 7Swaraj Behera 7
Hi Please try it as per the requirement.

Controller:-
public class theController {

   String searchText;
   List<Lead> results;

   public String getSearchText() {
      return searchText;
   }

   public void setSearchText(String s) {
      searchText = s;
   }

   public List<Lead> getResults() {
      return results;
   }

   public PageReference doSearch() {
      results = (List<Lead>)[FIND :searchText RETURNING Lead(Name, Email, Phone)][0];
      return null;
   }

}
VF page:-
<apex:page controller="theController">
   <apex:form >
      <apex:pageBlock mode="edit" id="block">
         <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
               <apex:outputLabel for="searchText">Search Text</apex:outputLabel>
               <apex:panelGroup >
                  <apex:inputText id="searchText" value="{!searchText}"/>
                  <apex:commandButton value="Go!" action="{!doSearch}" 
                                      rerender="block" status="status"/>
               </apex:panelGroup>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:actionStatus id="status" startText="requesting..."/>
        <apex:pageBlockSection title="Results" id="results" columns="1">
           <apex:pageBlockTable value="{!results}" var="l" 
                               rendered="{!NOT(ISNULL(results))}">
              <apex:column value="{!l.name}"/>
              <apex:column value="{!l.email}"/>
              <apex:column value="{!l.phone}"/>
           </apex:pageBlockTable>
        </apex:pageBlockSection>
      </apex:pageBlock>
   </apex:form>
</apex:page>

Thanks


 
S SaiS Sai
HI Swaraj,

Thanks for reply no need to use " <apex:pageblockTable "

Thanks