I'm trying to render a general link field like this - FieldRenderer.Render(item, "link")
.
This works as expected but how do I set custom text within the a tag that gets rendered. I want my output to look something like this
<a href="[link from sitecore]">[custom text from another field]</a>
Basically, the text for the link should come from another field on the item.
Thanks
Jason has a great idea, but this functionality is out of the box.
@Html.Sitecore().BeginField("Link Field", new { haschildren= true })
@Html.Sitecore().Field("Text Field")
@Html.Sitecore().EndField()
No need to modify anything at all.