You need to sign in to do that
Don't have an account?

Redirect to vf page by selecting an account from a table
I have a scenario where the user has to slect the account and redirect to a new vf page but I am not able to pass the account id so that the new page displays the details about the selected account. I have posted the vf page and controller code.
Thanks in Advance!
Thanks in Advance!
<apex:page controller="pagination" tabStyle="Account"> <apex:form > <apex:pageBlock > Page No: {!pageNo} <br/><br/> <apex:pageBlockTable value="{!Accounts}" var="a" rows="10"> <apex:column > <apex:actionSupport action="{!account}" event="onclick"> <apex:outputtext value="{!a.id}"/> </apex:actionSupport> </apex:column> <apex:column > {!a.name} </apex:column> </apex:pageBlockTable> </apex:pageBlock> <apex:commandButton value="Previous" action="{!previous}" disabled="{!!hasPrevious}"/> <apex:commandButton value="Next" action="{!next}" disabled="{!!hasNext}"/> </apex:form> </apex:page>
public class pagination { Public Integer size{get;set;} Public Integer noOfRecords{get; set;} Account accnt; Public Integer pageNo { get { if(pageNo == null) { return 1; } return pageNo; } set; } public ApexPages.Standardsetcontroller setcon { get { if(setcon == null) { size = 5; string querystring = 'select name,type from account order by name'; setcon = new ApexPages.Standardsetcontroller(Database.getQueryLocator(querystring)); setcon.setpagesize(size); noOfRecords = setcon.getResultSize(); } return setcon; } set {} } public list<Account> getAccounts () { List<Account> accntList = new List<Account>() ; for(Account a: (List<Account>) setcon.getRecords()) { accntList.add(a); } return accntList; } public void setAccount (Account accnt) { this.accnt = accnt; System.debug('@@'+accnt); } public void next() { pageNo = pageNo+1; setcon.next(); } public void previous() { pageNo = pageNo-1; setcon.previous(); } public Boolean hasNext { get { return setCon.getHasNext(); } set; } public boolean hasPrevious { get { return setCon.getHasPrevious(); } set; } public PageReference account() { //Account accnt; PageReference ref = new PageReference('/apex/wizard2?id='+accnt); ref.setRedirect(true); return ref; } }
Remove all colmns onli one colomn .
add inside colmn .
Any issue ask me .
Regards,
harish.R.
All Answers
Remove all colmns onli one colomn .
add inside colmn .
Any issue ask me .
Regards,
harish.R.
But is there any way I can get this id in controller class?