i am working on a gridview in which i want to list all the users
in the gridview i want all the usernames along with their avatar images and if any user doesn't have avatar image then gridview should display the default avatar image for that user,
Till now i have done this in which image is not getting displayed as well as each user is getting repeated 4 times
I tried looking how product images are rendered in a grid but still having problem with this...
i would appreciate if anyone could help me with this...
But the only concern is, if any user doesn't have any avatar/profile image, it is displaying "No Image Available" that is coming from product, but i guess it should display the default avatar image.
Add this to PictureManager.cs: public static string GetAvatarUrl(int imageId) { if (imageId == 0) { return PictureManager.LocalImagePath + SettingManager.GetSettingValue("Media.Customer.DefaultAvatarImageName"); } else { return GetPictureUrl(imageId); } }
Then change the image element like this: <asp:Image ID="imgAvatar" runat="server" ImageUrl='<%# PictureManager.GetAvatarUrl(Convert.ToInt32(Eval("AvatarID"))) %>' />
ok deccks i did exactly what you told me > re-built the project after making changes now nothing (no image) is getting displayed for user who doesn't have any avatar pic...
and i noticed the img tag you posted earlier and later, both are same except ID (only img ID is different)
I tried it a couple of different ways but I can't get the default avatar to display. Here is the code that I left off with. Hope you can get it to work.