One of the messages I discovered in my PM Inbox last night was a question about displaying avatars. So in penance for ignoring the question for so long I wanted to provide an answer. This also worked perfectly in my goal to bring more attention to the Member Grid of Luv, where we added a Full User Name yesterday. Let's add an avatar as well!
The super smart developers on the Community Server Core Team have made displaying an avatar so simple it's almost a sin to call this post a Nuglet. If it were chocolate it would be a quarter of a Hershey's Kiss or something. This is a nuglet suffering from illusions of grandeur.
Anyway, to add the member avatar to the Member Grid of Luv, we make the change to the RepeaterPlusNone Template, adding a header, column and an <ASP:Image .. /> control and then in the codebehind grab the User object AvatarUrl.
Image imageAvatar = e.Item.FindControl("imageAvatar") as Image;
if (imageAvatar != null)
{
imageAvatar.ImageUrl = user.AvatarUrl;
}
Our custom avatar display is shown below. (The fat guy is me in a running outfit in August at the start of a 5K race. I'm much more svelte now, of course.)
