Dynamic Search Account Records
Visual force Page:
<apex:form >
<apex:pageBlock mode="Edit" id="block">
<apex:pageBlockSection title="Search Criteria">
<apex:pageBlockSectionItem >
<apex:outputLabel for="SearchText">Account Name Search</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="SearchText" value="{!SearchText}"/>
<apex:commandButton value="Search" action="{!doSearch}" rerender="block" status="status"/>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection ></apex:pageBlockSection>
<apex:actionStatus id="status" startText="requesting......."></apex:actionStatus>
<apex:pageBlockSection title="Results" id="results" columns="1">
<apex:pageBlockTable value="{!results}" var="item">
<apex:column value="{!item.name}"/>
<apex:column value="{!item.phone}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class ACAccountSearch {
public String SearchText{get;set;}
public list<Account> getResults() {
return results;
}
list<Account> results;
public PageReference doSearch() {
string qrystring='select Id,Name,Phone from Account where(Name like\'%'+SearchText+'%\')';
results =Database.query(qrystring);
return null;
}
}
*Please Feel Free to contact for quires *
0 comments:
Post a Comment