Reputation: 13343
Using standard sitecore controls (Link and Text), you can embed a text field within a link in the following way:
<sc:Link runat="server" Field="LinkUrl" >
<sc:Text runat="server" Field="LinkText" />
</sc:Link>
That will give you the ability to edit the text of one field and link of another field.
I have tried to replicate this using Glass, but have been unsuccessful. Something like this would be good (It doesn't work):
<%= Editable( x => x.LinkUrl,new { Text = Editable(Model,q => q.LinkText,null)}) %>
Is there another way of sorting this out?
There are two options I see if I cannot do this using standard glass functionality:
Upvotes: 1
Views: 3069
Reputation: 6518
If you are using Razor use this:
@using (BeginRenderLink(x => x.Link, isEditable: true))
{
@Editable(x => x.Title);
}
If you are using WebForms:
<%using(BeginRenderLink(x=>x.Link){ %>
<%=Editable(x=>x.Title) %>
<% } %>
Mike
Upvotes: 4
Reputation: 8877
If you are using Glass version 3, then you can't use Editable
on Link
and Image
fields.
Use RenderLink
and RenderImage
instead.
See here: http://glass.lu/docs/tutorial/sitecore/tutorial22/tutorial22.html
The Editable method is the most basic method to use to make a field editable and should be used with most fields that are page editable except the Image field and General Link field
Upvotes: 1