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

urgent: passing <apex:param with command button and command link
Hi All,
I have small problem...I am trying to show the related list of contacts i.e cases when i click on apecific contact name.
it is coming good with command link but having problem with command button....here is the code.....can any one rectify it pls...
<apex:page controller="Ccontactstocases" showChat="true" tabStyle="contract">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!con}" var="Allcontacts">
<apex:column value="{!Allcontacts.id}" />
<apex:column >
<apex:commandLink action="{!callcases}" styleClass="btn">
<apex:outputField value="{!Allcontacts.Name}"/>
<apex:param name="hi" value="{!Allcontacts.id}"/>
</apex:commandLink>
<apex:commandbutton action="{!callcases}" value="{!Allcontacts.Name}">
<apex:param name="hi" value="{!Allcontacts.id}" />
</apex:commandButton>
</apex:column>
<apex:column value="{!Allcontacts.title}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageBlockTable value="{!cases}" var="Allcases">
<apex:column value="{!Allcases.subject}"/>
<apex:column value="{!Allcases.priority}"/>
<apex:column value="{!Allcases.status}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
public class Ccontactstocases {
Public list<Contact> con{get;set;}
Public list<Case> cases{get;set;}
public Ccontactstocases ()
{
con = [select id,name, title from Contact limit 10];
}
public void callcases()
{
ID contactid = apexpages.currentpage().getparameters().get('hi');
cases =[select id,subject,priority,status from case where contactid = :contactid ];
}
}