Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Redirect back to the Page containing the block from Block View result

Vote:
 

Hi

I have a Block which is contained in the Page Content Area. Block Shows List of articles . Now I have Filter option where on click on the year, the articles is getting filtered.

On Click , I have put HtTP Post function which goes back to the Block controller Index Action and send result back to the Block View with Filtered view.

Now the Problem is that, on returning from postback, only Block view is shown (Block URL) but not the original page(page with the block) where it was shown originally with filtered result.

It can be done using JQuery, but is strictly advised not to use Jquery

Can anybody help me on this

//ashish

#194910
Jul 07, 2018 20:40
Ted
Vote:
 

Simply pass some additional parameters, such as the block ID or a complete URL, to the view so that it has what it needs to invoke the controller's action method.

Even with jQuery, you would need some parameters to specify which endpoint/payload to use for the POST request.

#194997
Edited, Jul 11, 2018 0:28
Vote:
 

To add to what Ted already said here is an old post by Henrik how one could tackle the redirect issue from a block controller: https://thisisnothing.nystrom.co.nz/2013/11/19/using-custom-forms-in-an-episerver-mvc-block-template/

If it would be ok to use AJAX calls then I would use a Web API endpoint to create the articles listing so you don't need to fully render the whole page each time a different filter is selected. Then on the other hand I would question the requirement for this filtering in a block as it sounds the block is not the main functionality on the page but used to display some latest articles or something like that - why not direct from the block to some advanced articles filtering page, where the filtering of articles is the main functionality ;-)

#195016
Jul 11, 2018 10:26
Vote:
 

Hi Ted and Antii,

Thanks for your answers. I now have used Ajax and the Problem got solved.

The Reason the Filtering is not used in other page to filter Articles as the requirement was to Lazy load the Articles in blocks under a page and filtering based on year on the same Block, This Block will be used in a multiple Location which should behave independently.

Regards,

Ashish

#195025
Edited, Jul 11, 2018 13:04
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.