You need to sign in to do that
Don't have an account?
ABHISHEK CHOPRA
To show a detail page on click of the record
Hi EveryOne,
Below is my Apex and VF code. What i want to acheive is when i click on the record displayed in the Page block section on a list of Account then the detail page of the same record is displyed under that section.
Apex Code:-
public class c4{
list <Account> acts1;
list <Account> acts2;
public list <Account> getacts1()
{
return acts1;
}
public list <Account> getacts2()
{
return acts2;
}
public pagereference direct()
{
acts1 = [Select Name , Type , Industry , Phone from Account where type='Customer - Direct'];
return null;
}
public pagereference channel()
{
acts2 = [Select Name , Type , Industry , Phone from Account where type='Customer - Channel'];
return null;
}
}
VF Code:-
<apex:page controller="c4" sidebar="false" >
<apex:form >
<apex:pageBlock title="Account Classification on click of a button">
<apex:pageblockSection id="a" >
<apex:commandButton value="Customer-Direct" action="{!direct}" reRender="a">
<apex:pageBlockTable value="{!acts1}" var="abc">
<apex:column value="{!abc.Name}"/>
<apex:column value="{!abc.Type}"/>
<apex:column value="{!abc.Industry}"/>
<apex:column value="{!abc.Phone}"/>
</apex:pageBlockTable>
</apex:commandButton>
<apex:commandButton value="Customer-Channel" action="{!channel}" reRender="a">
<apex:pageBlockTable value="{!acts2}" var="xyz">
<apex:column value="{!xyz.Name}"/>
<apex:column value="{!xyz.Type}"/>
<apex:column value="{!xyz.Industry}"/>
<apex:column value="{!xyz.Phone}"/>
</apex:pageBlockTable>
</apex:commandButton>
</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Below is my Apex and VF code. What i want to acheive is when i click on the record displayed in the Page block section on a list of Account then the detail page of the same record is displyed under that section.
Apex Code:-
public class c4{
list <Account> acts1;
list <Account> acts2;
public list <Account> getacts1()
{
return acts1;
}
public list <Account> getacts2()
{
return acts2;
}
public pagereference direct()
{
acts1 = [Select Name , Type , Industry , Phone from Account where type='Customer - Direct'];
return null;
}
public pagereference channel()
{
acts2 = [Select Name , Type , Industry , Phone from Account where type='Customer - Channel'];
return null;
}
}
VF Code:-
<apex:page controller="c4" sidebar="false" >
<apex:form >
<apex:pageBlock title="Account Classification on click of a button">
<apex:pageblockSection id="a" >
<apex:commandButton value="Customer-Direct" action="{!direct}" reRender="a">
<apex:pageBlockTable value="{!acts1}" var="abc">
<apex:column value="{!abc.Name}"/>
<apex:column value="{!abc.Type}"/>
<apex:column value="{!abc.Industry}"/>
<apex:column value="{!abc.Phone}"/>
</apex:pageBlockTable>
</apex:commandButton>
<apex:commandButton value="Customer-Channel" action="{!channel}" reRender="a">
<apex:pageBlockTable value="{!acts2}" var="xyz">
<apex:column value="{!xyz.Name}"/>
<apex:column value="{!xyz.Type}"/>
<apex:column value="{!xyz.Industry}"/>
<apex:column value="{!xyz.Phone}"/>
</apex:pageBlockTable>
</apex:commandButton>
</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
You can use the following method as the button action. where objectId is the SF Id of an object.
- http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_system_pagereference.htm
I hope it will be helpful.Best Regards
Rahul Kumar