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?
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.
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
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
Hi Dan,
Thank you for your response.
I managed to solve the issue with latter (RenderMVC controller).
Best regards, Sandro
is working on a reply...