Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
Hi,
I think that you could prepare custom renderer for LinkItemCollection, that will render a dropdownlist.
Then in your model use the statement below to display property:
@Html.PropertyFor(x => x.Links)
Here is a good article about rendering properties:
How to customize rendering of properties
and also the documentation:
Thank you Grzegorz, I'll rendered the linkitemcollection (to select homepage for country/language) that way, in Views/DisplayTemplates/LinkItemCollection.cshtml:
<select id="selectlanguages"> <option value="#">Select Country and Language</option> @foreach (var linkItem in Model ?? Enumerable.Empty<LinkItem>()) { string linkUrl; PermanentLinkMapStore.TryToMapped(linkItem.Href, out linkUrl); <option value=@linkUrl>@Html.ContentLink(linkItem)</option> } </select>
<script type="text/javascript"> $(function () { $("#selectlanguages").on("change", function () { window.location.href = $(this).val(); }); }); </script>
It's working fine.
Hi,
How would be the "episerver way" to render a linkitemcollection as a dropdownlist???. I know I can do it with normal techniques MVC .NET, but I wonder if with EpiServer 8 I can code it easily.
Regards