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

Rerender a page when action method using pageReference
Hi folks,
Can anyone tell me how to rerender a particular pageblock when the action method using pageReference?
My use case is I want to rerender a particular block when I click the command button
VFP:
Apex class:
Please someone telI me how to use Rerender attribute in that command button?
Thanks in advance
Karthick
Can anyone tell me how to rerender a particular pageblock when the action method using pageReference?
My use case is I want to rerender a particular block when I click the command button
VFP:
<apex:commandButton action="{!Download}" value="download" id="chatterDownload" reRender="FeedFilePanel" /><br/> <apex:outputPanel id="FeedFilePanel" rendered={!feedFile}> If you want to download the files that are attached to the Feeds then click below button<br/> <center> <apex:commandButton id="uploadZipButton" value="Download Files" action="{!uploadZip}" /></center> </apex:outputPanel>
Apex class:
public PageReference Download(){ feedFile=true; if(!feedItemList.isEmpty()){ String fileName = 'Feeds' + DateTime.Now() + '.pdf'; Apexpages.currentPage().getHeaders().put('content-disposition', 'attachment; filename=' + fileName); PageReference chatterdownload= Page.ChatterDownload; chatterdownload.setRedirect(false); return chatterdownload; } else{ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'No Feeds, Please select an another Date to Download')); return null; } }
Please someone telI me how to use Rerender attribute in that command button?
Thanks in advance
Karthick
Please use like below
<center> <apex:commandButton rerender = "Dummy" id="uploadZipButton" value="Download Files"action="{!uploadZip}" /></center>
</apex:outputPanel>
I have povided the id in rerender..you can provide the block id which you want to rerender.......provide the pageblock id
Thanks
I want to use rerender attribute in first command button?
for that how can i implement
For first one you ahve already implemented..if your download method will return null then it will rerender else it will redirect to the mentioned page as you mentioned in page
PageReference chatterdownload= Page.ChatterDownload;
chatterdownload.setRedirect(false);
return chatterdownload;
What issue you are facing ? It will redirect if it will execute above code
Thanks
Hi Sandeep,
For first one it doesnt rerender the output panel.
My use case is when i click the download button then it will download the page(second page ChatterDownload). but I don't want to redirect that page(for that am giving setRedirect false.).After that output panel must be rerender?
for that how can I implement
You cannot use rendered and rerender attribute at the same time, To avoid this problem you need to create another outputpanel. Find the below code, it will be helpful to you..!
I agree with Arun, please use the code which he mentioned..it's a known behaviour or these 2 attributes..
Thansk
The reason your code is not working is that if your panel is not rendered first time you can't reRender it.
That is why I have added another panel which will always load inside that is your panel
Use the below code this will work
Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
I want to work both at the same time
Thanks for your response.I have changed my code.
But again it doesnt reRender ..
the code is
Thanks in advance
Karthick
The above changed code is working fine to me, can you share your full code to solve this problem.
after downloading the second page(chatterDownload) I wnat to rerender the output panel .But above code is not working ...
Use this code and let me know if any issue
Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
Use the below page
Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
It's not working..The action method Download use PageReferecne class.
Just comment all the code in your Download function.
Just make the field value as true and check if It works.
I know how to use rerender attribute...
But I want to know how we can use rerender attribute when the action method using page reference.?
I have done a simple example for your understanding.
Please read the comments in the page and let me know if you have any question.
Page --- Class--
Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help