Dave Burke : Freelance .NET Web Developer specializing in Online Communities

CS Nuglet: Customizing the Member Luv Grid

The Community Server User Grid doesn't get enough respect.  To me its a good way for communities to learn more about other members of the community at a glance.  Registered users can access the Member List at http://yoursite/user/members.aspx.  The page is not available to anonymous users.

The Member List page contains sophisticated filtering and sorting, but not a lot of information in the grid.  This is by design, since the username is a hyperlink to the individual's profile.  We can add member information to this grid pretty easily, as each record is populated by the CS User object which contains all kinds of good info, that is, if the individual supplies it in his or her profile. That's the kicker.

The /user/members.aspx page uses the /themes/default/skins/view-ForumMembers.ascx control to load the CS UserSearch control at top of the page and the grid at the bottom in the form of a CS RepeaterPlusNone control, a smart templated repeater.

We're going to add a User Full Name column to the grid and will update the RepeaterPlusNone control like any typical ASP.NET templated control.

// View-ForumMembers.ascx

<ItemTemplate>
<tr>
<td class="CommonListCellLeftMost">
<div><asp:hyperlink id="Username" runat="server" /></div>
<div id="LocationDiv" runat="server"><asp:literal id="Location" runat="server" /></div>
</td>
<td align="center" class="CommonListCell">
    <asp:literal id="UserFullName" runat="server" />&nbsp;
</td>
.....

The source for this control is in CS.Forums.Controls.ForumMembersView.  This is what we add to the control's UserList_ItemDataBound() event.

 

Literal UserFullName = e.Item.FindControl("UserFullName") as Literal;
if (UserFullName != null)
{
if (user.CommonNameOrUserName != null && user.CommonNameOrUserName != user.DisplayName)
    UserFullName.Text = user.CommonNameOrUserName;
}

 

resulting in something like this

 


and on our way to singing along with The Youngbloods, "Come on people now.  Smile on your brother, everybody get together, try to love one another right now.  Right now.  Right now (repeat and fade)"

[Update:  My pal, Cheeseflavor Dude, corrected me on the origin of "Let's Get Together" as being written by the Youngbloods and not the Dave Clark Five as I had originally wrote.  Another CS Nuglet with so much potential now in the crapper.]

Comments (6) | Post RSS RSS comment feed

Posted on 10/12/2006 7:29:47 AM by Dave Burke
Categories: Community Server
Tags:

Related posts

Comments (6) -

10/12/2006 7:59:41 AM Permalink

Not to nit-pick, but wasn't the aforementioned song by the Youngbloods?

Anyway, yet another great tidbit (oops, Nuglet) by our favorite Dave, and another shining example of why I need to get off my duff and learn how to use the Visual Studio 2005 that came with my MSDN subscription for something other than a CSS editor Smile

Take care!

Steve

Cheeseflavor |

10/12/2006 8:39:56 AM Permalink

I should have double-checked on my Big Chill Soundtrack.  Thanks for the correction.

That is SO embarrassing!  It's ALMOST as embarrassing as having an MSDN subscription and not learning Visual Studio 2005!  Almost! Smile

daveburke |

10/12/2006 8:40:59 AM Permalink

Oh, btw, Cheeseflavor, the multi-home page aggregate display is still in the CS Nuglet queue.

daveburke |

10/12/2006 9:15:52 AM Permalink

this is great dave. can I add a field for the member's avatar too?

ngm |

10/12/2006 9:20:25 AM Permalink

Ngm, first of all, thanks!  As for the member's avatar, you mean the badge with each post?  The short answer is YES, the longer answer is I'd have to find out the specifics on how.  I'm sure its as easy as updating the member grid.  Cheers!

daveburke |

10/14/2006 4:17:00 PM Permalink

I'm also very interested in showing the avatar in that list.

Cainrajraj |


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke