Copied to clipboard

Flag this post as spam?

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

  • Mark Watson 65 posts 185 karma points
    Jun 21, 2018 @ 01:52
    Mark Watson

    How do you sort a partial view

    I have created a partial view "Physicians" that displays a list of all active members. How do I display the members for each state. The state selection is controled by a drop down menu and displayed in the partial view by the var selectedState.

    <h3>New South Wales</h3>




  • pranjal 75 posts 187 karma points
    Jun 21, 2018 @ 13:36

    Use Umbraco Razor Sort nodes in ascending and descending order

  • Mark Watson 65 posts 185 karma points
    Jun 21, 2018 @ 22:59
    Mark Watson

    Thanks Pranjal

    How do i do that i am new to Umbraco?

  • Nathan Woulfe 322 posts 1171 karma points MVP c-trib
    Jun 22, 2018 @ 03:23
    Nathan Woulfe

    Hi Mark

    I'm guessing there's logic feeding the list of physicians back to your partial view (or living in the view itself)? From your main view, you could pass a parameter to the partial to use as a filter for the complete set of members.

    @Html.Partial("Physicians", new ViewDataDictionary({{ state = "Queensland" }}));

    Which would be available in the partial as


    Another option would be Html.Action:

    @Html.Action("MyMethodName", "MyController", new { state = "Queensland" });

    Which can still use the same Physicians partial UI, but would move the logic into MyMethodName on MyController, where state would be passed in as a parameter of MyMethodName. From there, you return a model to the Physicians partial, and enjoy strongly-type goodness in your UI

Please Sign in or register to post replies

Write your reply to: