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

CS Nuglet: Displaying a Member Avatar

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.)

Comments (2) | Post RSS RSS comment feed

Posted on 10/13/2006 7:01:35 AM by Dave Burke
Categories:
Tags:

Related posts

Comments (2) -

10/14/2006 4:31:50 PM Permalink

I'm sorry. I don't understand how to do this. I'm not a programmer.
Could you be more specific? Where are these controls and templates you talk about etc.
?
codebehind?

Cainrajraj |

11/16/2006 1:06:39 AM Permalink

Hi Dave. How to show avatars in Favorite Users section? I think it's similar but not same procedure?

LacOniC |


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke