I always jump at the chance to work with Community Server Chameleon Group controls, as they are powerful, flexible and fun! An example of a Chameleon Group control out of the box is the display of blogs by blog group as shown here at communityserver.org.
Chameleon Group controls provide context for the Post List Control displayed within the group as well as metadata that can customize the Post List Control's behavior. In this post I'm going to focus on context and how the group and post Chameleon list controls work together.
Here's an example of a custom Chameleon Group Control used in my CS-Based Job Management Application. The page lists all Purchased Materials charged on a job for billing purposes, grouped by date.
The logic in creating a group display in Chameleon is to create a generic list of group objects with a property that can be passed to the Post List Control. In our example we're passing the purchase charge date from our Group List Control to our Post List Control.
This is how the Purchased Material Group List and Purchased Material Post List are associated on the web page shown above.
The key to setting the query for the group control is the PurchMatDayOfWeek="All" property in the QueryOverrides statement. We'll use that in our PurchMatGroupList.cs to create a generic list of PurchMatGroup objects based on the date the purchased material charges were created.
private List<PurchMatGroup> purchMatGroups = null;
public override object DataSource
if (purchMatGroups == null)
PurchMatGroupThreadQuery query = new PurchMatGroupThreadQuery();
if (query.JobDayOfWeek == JobDayOfWeek.All)
List<PurchMatGroup> _dayGroup = new List<PurchMatGroup>();
int _postID = CSContext.Current.GetIntFromQueryString("postID", -1);
List<DateTime> _chargeDates = PurchMat.GetPurchMatSummaryGroupDates(_postID);
if (_chargeDates.Count > 0)
foreach (DateTime _chargeDate in _chargeDates)
purchMatGroups = _dayGroup;
The Purchased Material Post List control knows its group context and uses the PurchMatGroup.ScheduleDate property in its query to return the purchased materials charged on that date.
PurchMatGroup group = PurchMatControlUtility.Instance().GetCurrentPurchMatGroup(this);
if (group != null)
List<PurchMatPost> posts =
PurchMat.GetPurchMatPostList(jobPost.PostID, this.UserID, group.ScheduleDate);
purchMatPosts = posts;
Yes, for being a rather non-social fellow, I do like those Chameleon Group Controls.