VF Code:
<apex:page sidebar="false" showHeader="false" controller="ser" tabstyle="account">
<apex:form >
<apex:pageBlock >
<apex:panelGrid title="search your query">
<apex:outputText >Book name</apex:outputText>
<apex:inputText value="{!accname}"/>
<apex:commandButton value="Search" action="{!search}"/>
<apex:pageBlockTable value="{!accname1}" var="b">
<apex:column value="{!b.id}"/>
<apex:column value="{!b.name}"/>
</apex:pageBlockTable>
</apex:panelGrid>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Class Code:
public class ser {
public string accname{set;get;}
public string item{set;get;}
public string accname1{set;}
account bk = new account();
public pagereference search(){
bk = [select id,name from account where name = : accname];
return null;
}
public account getaccname1(){
return bk;
}
}
No comments:
Post a Comment