Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sandro 7 posts 97 karma points
    Apr 03, 2017 @ 11:29
    Sandro
    0

    Filtering Content and returning from SurfaceController

    Hi,

    I have question concerning filtering content data.

    In my application content tree there is a node "Cases" which has multiple descendants type of "Case".

    Then, in my "Cases" View I render Partial View that is basically a form which contains dropdowns for filtering.

    Whenever user clicks submit button (which is on the filter form, i.e. in my Partial View), post request is sent to my FilterController, then I query my content according to post parameters and I am stuck on this step because I need to return these results (some subset of cases) to current umbraco page, i.e. "Cases" view but I couldn't figure out how it is done, Umbraco doesn't seem to have this feature.

    Could you help me with that?

    Or maybe I am doing all filtering process wrong. In this case, could you suggest proper way to filter data on button click and display it to user?

    Regards, Sandro

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Apr 03, 2017 @ 11:48
    Dan Diplo
    100

    Generally you have a couple of options. You can continue to use a Surface Controller and then return a partial view containing the results of your filtering (using a child action). You then call the controller using the @Html.Action syntax.

    Alternatively, you could use a RenderMVC Controller instead to return a custom viewmodel to your page template. This view model would contain your search criteria and your search results, and would be populated by the controller.

    https://our.umbraco.org/documentation/Reference/Routing/custom-controllers

  • Sandro 7 posts 97 karma points
    Apr 06, 2017 @ 06:03
    Sandro
    0

    Hi Dan,

    Thank you for your response.

    I managed to solve the issue with latter (RenderMVC controller).

    Best regards, Sandro

Please Sign in or register to post replies

Write your reply to:

Draft