1

I've have a General Link field. Using 'Insert media link' I have it pointed to a Media Item under the Media Library.

When the page is rendered in the Experience Editor Mode, Link correctly display the Media Item Name and you can get the usual control above it to modify the Link. However in the preview mode it generates an empty Link Text.

If I use the Sitecore Field renderer for the same field, it correctly shows the Media Item name as the Link text.

Here's the code used in the control -

<br />
<%=Editable(x=> x.ReadMore )%>
<br />
<sc:Link runat="server" Field="ReadMore" />

Here's the output I get in the preview mode for both -

<br>
<a href="http://sc81u3.local/-/media/Files/SomePDF.ashx"></a>
<br>
<a href="http://sc81u3.local/-/media/Files/SomePDF.ashx">SomePDF</a>

If I insert a Link using the "Insert link" option available on a General Link field, this is not a problem.

Question: Is this a issue with Glass Mapper or am I missing something here?

Glass Mapper Version: V4 Sitecore Version: 8.1 update 3

1

In order to render a link with glass you need to do the following:

<%= RenderLink(x => x.ReadMore) %>

Or in MVC:

@Html.Glass().RenderLink(x => x.ReadMore)
1
  • Dylan, thanks for the response but RenderLink also has the same issue. Generates the link with an empty link description for the above scenario.
    – Milan
    Dec 6 '17 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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