Welcome Guest, you are in: Namespace

How-To Guide on using the smart User Role Placeholder Controls to display page content based on user role

Display Content to Anonymous Users, to a Single Group or Many

The Sueetie User Role Placeholder Controls give you the ability to display content based on if the user is an anonymous user or if he or she is in a given role: Registered, ContentAdministrator, BlogAdministrator, etc.

Sueetie provides two roles for displaying content, the UserRolePlaceHolder control and the MultiRolePlaceHolder control. The UserRolePlaceHolder was the original user placeholder and came first. It supports a single role and display for anonymous users. The MultiRolePlaceHolder was added in Sueetie Version 3.1, supporting multiple roles and a special IsAnonymous Role for easier use.

UserRolePlaceHolder

The original UserRolePlaceHolder control supports a single role and only one of Sueetie's default roles. This is for easier use, but can limit it's versatility somewhat. Here's a screenshot of using the UserRolePlaceHolder and the built-in Intellisense for Role selection.

Image

If you want to display the content to anonymous users only, you would select the "NonMember" role.

MultiRolePlaceHolder

The MultiRolePlaceHolder was released with Sueetie v3.1 and was intended to replace the existing UserRolePlaceHolder. Because of the extensive use of the UserRolePlaceHolder and the changes required by administrators when upgrading to v3.1 it was decided to add a separate role-based content display control and call it MultiRolePlaceHolder.

As its name implies, the MultiRolePlaceHolder supports the display of the content area to multiple roles by entering them in the "Roles" property as a common-delimited string. Here's what that looks like.

Image

To display the content area to anonymous users only, the MultiRolePlaceHolder adds a "IsAnonymous" property which defaults to "false." Simply add IsAnonymous="true" to the control HTML with no "Roles" property to display content to anonymous users.

Image

True/False Display

Finally, both Placeholder Controls use "TrueContentTemplate" and "FalseContentTemplate" containers to display content based on role inclusion or exclusion of the current user. You can see those in use in the two prior screenshots above.

Top

ScrewTurn Wiki version 3.0.4.560.

Copyright © 2008-2012 Sueetie LLC. All rights reserved.
Sueetie