Reputation: 123
I try this but not work
@if (PortalContext.CurrentUser.ImageUrl != null)
{
<img src="@Url.Content(PortalContext.CurrentUser.ImageUrl)" alt="Picture" style="width: 160px; height: 160px;" />
}
else
{
//This Image show, when "PortalContext.CurrentUser.ImageUrl" image not view
< img src="~/images/user-default-image.png" alt="Picture" style="width: 160px; height: 160px;" />
}
If "PortalContext.CurrentUser.ImageUrl" content image path but anyhow image not preview then default image show. How to do this?
Upvotes: 1
Views: 1050
Reputation: 41
In Razor
Page :
src="@(PortalContext.CurrentUser.ImageUrl == null ? Href("~/assets/images/PhotoDefaultProfile.png") : PortalContext.CurrentUser.ImageUrl
Upvotes: 1