function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Venkata Sravan Kumar BandariVenkata Sravan Kumar Bandari 

I want to pass parameters from command link to controller how it is possible.......?

<apex:repeat value="{!pages}" var="page">
      <apex:commandlink value="{!page}" action="{!displayPage}">
      <apex:param value="page" name="number" assignTo="{!pageNumber}"/>
      </apex:commandLink>&nbsp;&nbsp;
  </apex:repeat>
Here i am displaying commandlinks 1 2 3 ......when i click on the link respective number will pass to controller..is it possible....?
Thanks in advance 
Jigar.LakhaniJigar.Lakhani
Hello,

You need to use apex:actionfunction.

You can use below code for your page and controller.

Apex Page:
<apex:actionFunction name="afDisplayPage" action="{!displayPage}">
	<apex:param name="prmPageNumber" value="" />
</apex:actionFunction>
<apex:repeat value="{!pages}" var="page">
	<apex:commandlink value="{!page}" onclick="afDisplayPage('{!page}')" />&nbsp;&nbsp;
</apex:repeat>
Apex Class:
Public Class YourController(){
	
	Public PageReference displayPage(){
		String strPageNumber = ApexPages.CurrentPage().getParameters().get('prmPageNumber');
		System.debug('######## strPageNumber   '+strPageNumber);
		return null;
	}
	
}

Thanks and Cheers,
Jigar


 
gokul bharatigokul bharati
Hi Venkata,

Yes its possible,

Like the sample below which i have used in my VF page.

VF page:

<apex:commandLink action="{!goEOLPage}" style="color:#c71444;text-decoration:none;" value="{!$Label.LinkPayLiability}"> <apex:param value="3" assignTo="{!eolSec}"/> <apex:param name="EndOfLease" value="EndOfLease" assignTo="{!RedirectPage}"/> </apex:commandLink>

On clicking the commandLink it sets the value. of the variable RedirectPage and Eol Sec  in the controller.

Controller:

public string eolSec{get;set;}
public string RedirectPage  {get;set;}

Thanks,
Gokul