Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • ggesheva 15 posts 116 karma points
    May 22, 2020 @ 07:33
    ggesheva
    0

    Problem getting avatars from members/Value cannot be null - mediaItem.

    Hello there! I am having difficulties with displaying avatars assigned to the members.

     <div class="coaches-carousel">
                @if (coachesList.Count() > 0)
                {
                    foreach (var coach in coachesList.Where(itm => itm.GetValue<bool>("wwunavailable") == false))
                    {
                        if (coach.GetValue<string>("wwavatar").IsNumeric())
                        {
                            mediaItemId = Convert.ToInt32(coach.GetValue<string>("wwavatar"));
                        }
                        else if (!string.IsNullOrEmpty(coach.GetValue<string>("wwavatar")))
                        {
                            mediaItemId = coach.GetValue<string>("wwavatar").GetIdByUdi();
                        }
    
                        <div class="coaches-carousel-item">
                            <a href="#">
                                <img src="@Umbraco.TypedMedia(mediaItemId).GetCropUrl("coach")" alt="@coach.Name" />
                            </a>
                        </div>
                    }
                }
            </div>
    

    Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: mediaItem

    Any idea how I can display them?

Please Sign in or register to post replies

Write your reply to:

Draft