Monday, July 7, 2014

Passing parameters with Command Link

Passing parameters with Command Link

create a command link and pass arguements. In the apex class you can get the parameters and use the value in your code.

Visual Force Page:

<apex:page controller="showCammand"> 
<apex:form> 
<apex:commandLink id="commandLink" action="{!displayName}" value="Show my name">
 <apex:param name="Name" value="myName"/> 
</apex:commandLink> 
<br/> My name: {!name} 
</apex:form> 
</apex:page>


Apex Class:

public class showCammand()
{
public String name {get; set;}
public void displayName()
{
name = ApexPages.CurrentPage().getParameters().get('Name');
}
}







0 comments:

Post a Comment

 
| ,