Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi all,
So i created grid editor called profile card using leblender and one of the property is an image. I create a partial view for it , here is the code block.
@inherits UmbracoViewPage<Lecoati.LeBlender.Extension.Models.LeBlenderModel> @using Umbraco.Web.Templates @foreach(var item in Model.Items) { <div class="media d-block media-custom text-center"> <img src=" @Umbraco.TypedMedia(item.GetValue<string>("image")).Url"> <div class="media-body"> <h3 class="mt-0 text-black">@item.GetValue("name")</h3> <p>@item.GetValue("description")</p> <p> <a href="mailto:@item.GetValue("contactDetails")" class="p-2"><span class="fa fa-envelope-o"></span></a> </p> </div> </div>
}
When I publish the page it gives me Object reference not set to an instance of an object error.
I have used the same code in img src to render an image but it was in umbraco 7.5.13 currently i am using 7.7.
Am I missing something or gone way off? Please help I would really appreciate that :)
Hi Hasan
Replace image rendering with code below:
<img src="@item.GetPropertyValue<IPublishedContent>("image")).Url">
It can be a solution.
Thanks,
Alex
Hi Alex, thank you for the reply I have used the line of code in my partial view but i get this error now
At which line do you have this error?
On that img tag line , here is the code snippet
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Getting image to render from partial view using blender package
Hi all,
So i created grid editor called profile card using leblender and one of the property is an image. I create a partial view for it , here is the code block.
}
When I publish the page it gives me Object reference not set to an instance of an object error.
I have used the same code in img src to render an image but it was in umbraco 7.5.13 currently i am using 7.7.
Am I missing something or gone way off? Please help I would really appreciate that :)
Hi Hasan
Replace image rendering with code below:
It can be a solution.
Thanks,
Alex
Hi Alex, thank you for the reply I have used the line of code in my partial view but i get this error now
Hi Hasan
At which line do you have this error?
On that img tag line , here is the code snippet
is working on a reply...