lnkCreateAccount.Text = umbraco.library.GetDictionaryItem("CreateAccount"); gets the correct dictonary item but how can i use the {localLink} functionallity and the recursive="true" inside my Visual Studio procject?
Are you using this C# code in a usercontrol? In that case instead of setting the text on a Label just place the Umbraco item in the .ascx file. That's supported :). So all the code you've got on your first post will work.
If you use NodeFactory instead, you can create an extension method called GetPropertyValueRecursive to do this for you.
At the bottom of this blog post is a useful UmbracoExtensions class that includes this and some other helpful functions. It's written for the old version of nodeFactory but all you should have to do is change using umbraco.presentation.nodeFactory to umbraco.NodeFactory.
Use localLink and umbraco item recursive in c# (visual studio)
Hello,
Ive got the following code in my template:
<p><a href="{localLink:<umbraco:Item field='intLinkCreateAccount' recursive='true' runat='server'></umbraco:Item>}" class="register"><umbraco:Item field="#CreateAccount" runat="server"></umbraco:Item></a> | <a href="#" class="login-logout">Login</a></p>
Now i want to use c# for doing this:
lnkCreateAccount.Text = umbraco.library.GetDictionaryItem("CreateAccount"); gets the correct dictonary item but how can i use the {localLink} functionallity and the recursive="true" inside my Visual Studio procject?
ok i think i can use umbraco.library.NiceUrl instead of localLink but how can i get the umbraco item with recursive = True in umbraco
does not work. I need a possibility to get it with recursive="true"
Can someone please help?
Are you using this C# code in a usercontrol? In that case instead of setting the text on a Label just place the Umbraco item in the .ascx file. That's supported :). So all the code you've got on your first post will work.
Jeroen
i do not want to use the code in ascx file i want to use it inside the code behind script
So please tell me how i can use the GetItem method with "recursive=true" inside the code behind script
Thanks
Hi,
If you use NodeFactory instead, you can create an extension method called GetPropertyValueRecursive to do this for you.
At the bottom of this blog post is a useful UmbracoExtensions class that includes this and some other helpful functions. It's written for the old version of nodeFactory but all you should have to do is change using umbraco.presentation.nodeFactory to umbraco.NodeFactory.
Then you can do something like
lblCreateAccount.Text = Node.GetCurrent().GetPropertyValueRecursive("intLinkCreateAccount");
Hope this helps,
Tom
is working on a reply...