Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Displaying avatar image to literal from code behind View modes: 
User avatar
Member
Member
gatsby0121 - 11/25/2011 5:59:22 AM
   
Displaying avatar image to literal from code behind
I've written a custom module that grabs all users of a specific role, then grabs the avatar id, and loads that into AvatarInfo. How can I use this to ouput the avatar image onto the page, from codebehind?

User avatar
Member
Member
gatsby0121 - 11/25/2011 6:15:25 AM
   
RE:Displaying avatar image to literal from code behind
I've got this working with this:

string avatarImg = <img style=\"border-width: 0px;\" alt=\"Andy\" 
src=\"/CMSModules/Avatars/CMSPages/GetAvatar.aspx?avatarguid="+ ai.AvatarGUID.ToString() +"&maxsidesize=50\" />";

And then outputting that to the literal text property.

Is that best practice?

User avatar
Member
Member
kentico_michal - 11/29/2011 5:20:00 AM
   
RE:Displaying avatar image to literal from code behind
Hello,

Yes, it can be considered as a best practice. In fact, the pre-defined transformation
method GetUserAvatarImage uses internally the CMSModules/Avatars/CMSPages/GetAvatar.aspx page as well.

Best regards,
Michal Legen