1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Get number of users in each role (User Administration)

Get number of users in each role (User Administration)

1 posts, 0 answered
  1. Chanan Zass
    Chanan Zass avatar
    123 posts
    Registered:
    21 Aug 2012
    14 Aug 2012
    Link to this post
    We're trying to get in Sitefinity 5.1 the same features available in Sitefinity 3.7. In this case, when managing users and viewing the list of roles in the right column, we'd like to display the number of users in each role group.
    As mentioned this was offered by default in Sitefinity 3.7.
    We've tried using the template available in the SDK:
    WidgetTemplates.zip -- Backend -- Security -- Principlas -- UsersCommandPanel.ascx.
    We uncommented the following commented strings:
    <div class="sfAllFilter sfRolesFilter">
            <asp:LinkButton runat="server" ID="cmdLoggedInUsers" CommandName="LoggedInUsers" Text="<%$ Resources:Labels, FilterLoggedInUsersText %>"
               OnClientClick="LoggedInUsers(this);return false;" ></asp:LinkButton>
               <%--<span class="sfCount" ID="LoggedInCount">(0)</span>--%>
        </div>

    And
    <sitefinity:GenericCollectionBinder ID="rolesBinder" runat="server"
            TargetId="rolesList"
            ServiceUrl="~/Sitefinity/Services/Security/Roles.svc"
            BindOnLoad="true"
            OnClientItemEditCommand="rolesBinder_EditItemCommand"
            OnClientDataBound="rolesBinder_DataBound"
            OnClientItemDataBound="rolesBinder_ItemDataBound"
            DataKeyNames="Name"
            DataMembers="Name, UsersInRole, ProviderName, Id, ProviderTitle"
            <Containers>
                <sitefinity:BinderContainer runat="server" RenderContainer="false" TemplateHolderTag="UL"
                    <li>
                        <a id="roleCommand" sys:href="javascript:void(0);" class="editCommand">{{Name}}{{ProviderTitle}}</a> <%--<span class="sfCount">({{Number(UsersInRole)}})</span>--%>
                    </li>
                </sitefinity:BinderContainer>
            </Containers>     
        </sitefinity:GenericCollectionBinder>

    However, the expression {{Number(UsersInRole)}}
    produces 0 (zero).

    Is UsersInRole DataMember not included yet in the collection?

    Any help would be most welcome.
    P.S. I should mention that the edited template has been registered in Administration -- Settings -- Advanced -- Controls -- ViewMaps





1 posts, 0 answered