Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I have a simple razor script in Umbraco for a menu. I want to put an asterix in front of the links:
<ul> @foreach (var page in Model.AncestorOrSelf(2).Children){ <li>*<a href="@page.Url" title="@page.Name"> @page.Name</a></li>}</ul>
However, it renders like this putting the first asterix behind the link and not before:
First link *
* Second link
Anyone knows how to put the asterix in front of the link every time. Eventually by the attribute "InstertBefore", but any small trick will do :-)
Thank you in advance for any help.
Lars
<li> <a href="@page.Url" title="@page.Name"> @:* @page.Name</a></li>
Hi Fuji
Thank you for your answer. However I can still not make it work. When I save the code Umbraco returns an error:
"Error occured":" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{" are valid."
Do you know how to fix that error.
Regards,Lars
Your first solution should actually work fine, I just tested myself.
I believe you might have some CSS that is moving it around a bit funny.
If you dont mind the asterix to be a part of the link you could do this:
<ul>@foreach (var page in Model.AncestorOrSelf(2).Children){ <li><ahref="@page.Url"title="@page.Name">* @page.Name</a></li>}</ul>
That should work, even with some funky CSS.
Did you get this working ?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Razor will not put a character before
Hi
I have a simple razor script in Umbraco for a menu. I want to put an asterix in front of the links:
However, it renders like this putting the first asterix behind the link and not before:
Anyone knows how to put the asterix in front of the link every time. Eventually by the attribute "InstertBefore", but any small trick will do :-)
Thank you in advance for any help.
Lars
Hi Fuji
Thank you for your answer. However I can still not make it work. When I save the code Umbraco returns an error:
"Error occured":" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{" are valid."
Do you know how to fix that error.
Regards,
Lars
Your first solution should actually work fine, I just tested myself.
I believe you might have some CSS that is moving it around a bit funny.
If you dont mind the asterix to be a part of the link you could do this:
That should work, even with some funky CSS.
Did you get this working ?
is working on a reply...