0

This is my View:

<div>
     @Html.Sitecore().Field("Image Field")
</div>

When I add this rendering to my Page in Sitecore SXA, it works perfectly, allowing the user to click on the image and edit it.

If I drop this rendering onto a tab, it stops working. Can anyone help me fix this please?

1 Answer 1

0

I fixed it with this:

@Html.Sitecore().Field(PracticeAreas.Products.ProductImage, Sitecore.Context.Item)

2
  • The field renderer uses the datasource and if no datasource is set the context item to render a field. It seems like that in your case the datasource of the tab is used instead of the context item. If you are sure, that you always want to use the context item, you are on the right track.
    – Fabian
    Commented Aug 11, 2022 at 9:43
  • 1
    You can accept your own answer. Sometimes it takes some time until you are able to do it. stackoverflow.blog/2009/01/06/accept-your-own-answers
    – Fabian
    Commented Aug 11, 2022 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.