Sort a list of users

Oct 28, 2015 at 12:48 AM
I have a list of DNN users and would like to sort them by name

@foreach( UserInfo aUser in theUsers)
How to I do this?
Oct 28, 2015 at 7:28 PM
The sample app "FAQ with Categories and 6 views" shows an example of sorting.

Check it out here: FAQ with Categories

From the sample:
    // Prepare the data - get all categories through the pipeline
    public override void CustomizeData()
        // new features in 6.1 - the App DataSource CreateSource<App> and also the RelationshipFilter
        var qsOfCat = CreateSource<RelationshipFilter>(App.Data["QandA"]);
        qsOfCat.Relationship = "Categories";
        qsOfCat.Filter = Content.Category.Count > 0 ? Content.Category[0].Name : "";
        var sorted = CreateSource<ValueSort>(qsOfCat);
        sorted.Attributes = "EntityTitle";
        Data.In.Add("QandA", sorted["Default"]);
And then...
    @foreach (var q in AsDynamic(Data["QandA"]))
        <li class="sc-element faq-set" data-tags="@String.Join(",", ((List<DynamicEntity>)q.Categories).Select(a => AsDynamic(a).EntityId))">
            <a class="faq-question" style="cursor: pointer">
            <div class="faq-answer" style="display: none">@Html.Raw(q.Answer)</div>