Trying to get my Url editable on preview page. Using MVC and I have sent my viewmodel to the view, and the property is of type Url and I have also used:
var editHints = ViewData.GetEditHints<ViewModel, MyBlock>();
My idea was to do like this:
But with no luck.
It works for my title.
This is one approach you can do:
<a href="@Url.ContentUrl(Model.Url)" @Html.EditAttributes(p => p.Url)>text</a>
Also just using PropertyFor without tag should render proper tag, but it will use URL instead of text:
@Html.PropertyFor(p => p.Url)
This article describes how PropertyFor works:
Thanks for your answer!
What about making the link and the text editable at the same time? ever tried to get this solved in a nice way?
I do not know how to do editing of link and text same time. It would be great if property of Url type would have also some Title field same as it is when you add link in TinyMCE editor.