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
Hello All!
I am having such structure:
1. language
2.page
On 1 level I have defined some item, for example item_language, with value 'en'.
On level 2, in template, I'm trying do to a redirect using this value.
For example, I've placed a asp:button, attached click event and I'm trying to get the value with the code below:
umbraco.presentation.nodeFactory.Node nd = umbraco.presentation.nodeFactory.Node.GetCurrent();umbraco.presentation.nodeFactory.Property pt = nd.GetProperty("item_language"); string val = string.Empty; if (pt != null) val = pt.Value; if(!string.IsNullOrEmpty(val)) Response.Redirect(val);
That of course doesn't work. It would work if I would be fetching item from the 2 level.
Does anyone knows how to do what I'm after here?
try
nd.parent.GetProperty("item_language");
Mikael
Thanks for good idea - I'll implement this recursively up to the very top. Should work for no matter how deep node level.
I think there is an API function for getting a property recursively, i just can't find it right now.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Pass item to c# code
Hello All!
I am having such structure:
1. language
2.page
On 1 level I have defined some item, for example item_language, with value 'en'.
On level 2, in template, I'm trying do to a redirect using this value.
For example, I've placed a asp:button, attached click event and I'm trying to get the value with the code below:
umbraco.presentation.nodeFactory.Node nd = umbraco.presentation.nodeFactory.Node.GetCurrent();
umbraco.presentation.nodeFactory.Property pt = nd.GetProperty("item_language");
string val = string.Empty;
if (pt != null)
val = pt.Value;
if(!string.IsNullOrEmpty(val))
Response.Redirect(val);
That of course doesn't work. It would work if I would be fetching item from the 2 level.
Does anyone knows how to do what I'm after here?
try
nd.parent.GetProperty("item_language");
Mikael
Thanks for good idea - I'll implement this recursively up to the very top. Should work for no matter how deep node level.
I think there is an API function for getting a property recursively, i just can't find it right now.
Mikael
is working on a reply...