• PiotrSobczak
  • NEWBIE
  • 0 Points
  • Member since 2016


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

I have a VF page which contains record id, name of account object and a button for each and every record as shown in image.User-added image
If i click the button for particular record, the respected record id should be displayed in same visualforce page. For that i created a class and VF page as given below.

VF Page:
<apex:page controller="one" action="{!save}">
    <apex:form >
        <apex:pageBlock id="one">
            <apex:pageBlockTable value="{!accs}" var="a">
                <apex:column value="{!a.id}"/>
                <apex:column value="{!a.name}"/>
                <apex:column >
                    <apex:commandButton value="click" action="{!save}" reRender="one"/>
                    <apex:param assignTo="{!accid}" value="{!a.id}"/>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>  
        ID:{!accid}
    </apex:form>
</apex:page>
Controller:
public class one{
    public string acName{set;get;}
    public integer acPhone{set;get;}
    public List<Account> accs{set;get;}
    public ID accid {set;get;}

    public pagereference save(){
        accs = [select id,name,phone,type from account limit 5];

        return null;
    }
}
I am unable to get this requirement. Could anyone please help me in this????
Thanking you
KS Kumaar