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
Varun99Varun99 

Pagereference

Hi,

 

In my visualforce page displayed records with pagination and  "edit" command link when i click on edit button

it will go to standard record edit mode when i cancel/save it will back to current page number but i have back to first page number.how to pass page number in pagereference?

 

Can any one help me?

 

Thank you 

Mudasir WaniMudasir Wani

Hi Varun,

 

You can use a controller variable to store the page number.

If you are using the action function you can update the variable by passing the value in param.

<apex:actionFunction action="{!methodOne}" name="methodOneInJavascript" rerender="showstate">
        <apex:param name="firstParam" assignTo="{!state}" value="" />
    </apex:actionFunction>

state will be name of your controller variable.

 

or simply you can store a value in hidden field and extract that value in your controller using

ApexPages.currentPage().getParameters().get('id').

make sure you have the hidden field inside the same form tags.

 

Varun99Varun99

Hi Mudasir,

 

Thanks for your reply.  Am passing id like

 

public void editrecord()

{

string bookingid= ApexPages.currentPage().getParameters().get('bookingid');
string aaaa=ApexPages.currentPage().getParameters().get('id');

 

PageReference page;

Page = new PageReference('/'+bookingid+'/e?retURL=/apex/bookingstatus?id='+aaaa);
return Page;

 

}

here bookingid is current edit recordid  but it return to first page number but not previous page number

 

my url like

 

https://c.ap1.visual.force.com/apex/bookingstatus?id=null

 

 

Can u help? where am mistake?

Mudasir WaniMudasir Wani

 

Hi Varun,

 

Use the following code.

 

PageReference page = new PageReference('/'+bookingid+'/e?retURL=/apex/bookingstatus?id='+aaaa);

page.setRedirect(true);

return page;

 

Regards,

Mudasir.