You need to sign in to do that
Don't have an account?
divay singh
how to open account info from search result in visualforce
I have created visualforce and apex class to search account. Now i want to click on the name which i get in result(Account name). So it should open new visual page with information
Yes we can show the selected account information in the new visualforce page.
First Page:
<apex:page controller="Account_info">
<apex:form >
<apex:pageBlock >
<apex:repeat value="{!acc}" var="a">
<apex:commandLink action="{!comdlink}">
{!a.Name}
<apex:param assignTo="{!accountinfo}" name="{!a.Id}" value="{!a.Id}"/>
</apex:commandLink><br/>
</apex:repeat>
</apex:pageBlock>
</apex:form>
</apex:page>
First Controller
public class Account_info {
public String comdlink {get;set;}
public String accountinfo {get;set;}
public List<Account> acc{get;set;}
public Account_info(){
acc=[select id,Name from account];
}
public PageReference comdlink (){
PageReference prf=new PageReference('apex/Account_DetailPage?id='+accountinfo);
return prf;
}
}
second Class:
<apex:page conntroller="Account_info2 ">
<apex:form>
<apex:pageBlock>
<apex:pageBlockTable value="{!acc}" var="ac">
<apex:column value="{!ac.Name}"/>
//you can add more accoutnfields
</apex:pageBlock>
</apex:from>
</apex:page>
public class Account_info2 {
public String comdlink {get;set;}
public String accountinfo {get;set;}
public List<Account> acc{get;set;}
public Account_info(){
comdlink=apexpages.currentpage().getparameters().get('id');
acc=[select id,Name from account where Name=:comdlink];
}
}
I hope this code will help your sinario.
If you got anser please mark as best answer.