Since I don't know your tree structure, I'm not sure whether I can help, but try having a look at this:
A small change for splitting the string. The extra parameter will make sure empy entries are removed. This will also mean, that if the string is empty, you will now have an empty array rather than an array with an empty string.
Thanks for the input but not really what am looking for. For the record am using the multiTreeNode picker to on a docType where user will be able to get display certain images on current node.
Having said that the first and last image will always be in their respective div container. However the 2nd and 3rd are both in the same container within another div container.
So for the 2nd and 3rd i was thinking of displayin them by doing something more like
If that is the case, the code can look something like this:
if (ids.Length >= 4) {
var nr1 = Library.MediaById(ids[0]);
var nr2 = Library.MediaById(ids[1]);
var nr3 = Library.MediaById(ids[2]);
var last = Library.MediaById(ids[ids.Length - 1]);
<div>@nr1</div>
<div>
<div>@nr2</div>
<div>@nr3</div>
</div>
<div>@last</div>
} else {
// less than four items in total - do something else
}
Thanks for the inpu. @Anders, when using your, method i get the duplicate values since the div is within the same inner div. First and Last has there own div container and 2nd and 3rd are within a div container but with their own div container again. :)
I you can describe how the HTML should look in various scenarios, I might be able to help you clean up your code a bit ;) Currently it seems you're using a loop of some kind - which as far as I have understood your problem - isn't the optimal solution.
Well it turns out since am using Mansonry Query to get some better results for responsive layouts the 3rd and 4th value gets a bit mess up in turns of positioning the div elements. :)
But so far everything is working as should will some "Ifs" !
Getting xth value from a multiNodeTree Picker
Can someone please tell me how do i retrieve the xth value from a multiNodeTree Picker.
For some reason i need to display xth of an image within a div where both xth values should be displayed differently,
Here is my razor code
Any suggestions please ?
Since I don't know your tree structure, I'm not sure whether I can help, but try having a look at this:
A small change for splitting the string. The extra parameter will make sure empy entries are removed. This will also mean, that if the string is empty, you will now have an empty array rather than an array with an empty string.
You can now loop through the ids with a for loop:
Hi Anders,
Thanks for the input but not really what am looking for. For the record am using the multiTreeNode picker to on a docType where user will be able to get display certain images on current node.
Having said that the first and last image will always be in their respective div container. However the 2nd and 3rd are both in the same container within another div container.
So for the 2nd and 3rd i was thinking of displayin them by doing something more like
But this aint working.
Hi Fuji,
I would use the code sample from here to get a collection and then just use the normal .Skip(2) method.
thanks,
Jeavon
Hi Jeavon,
Did that as well but still not working
So far this is working but here where i need to display not the prettiest wat of doing things but working
If someone has a better way, please do let know
Hey Fuji,
So jsut to be clear, you have a MNTP picking media and storing as CSV and you want to be able to retreive certain items based on position within MNTP?
Thanks,
Jeavon
I was thinking something like this:
But it might not be the right approach...
Let assume you have the images 1, 2, 3, 4 and 5. Should they be displayed something like this?
If that is the case, the code can look something like this:
Looks good Anders!
Hi Guys,
Thanks for the inpu. @Anders, when using your, method i get the duplicate values since the div is within the same inner div. First and Last has there own div container and 2nd and 3rd are within a div container but with their own div container again. :)
This works for me atm.
Hi Fuji,
I you can describe how the HTML should look in various scenarios, I might be able to help you clean up your code a bit ;) Currently it seems you're using a loop of some kind - which as far as I have understood your problem - isn't the optimal solution.
Hi Anders,
Well it turns out since am using Mansonry Query to get some better results for responsive layouts the 3rd and 4th value gets a bit mess up in turns of positioning the div elements. :)
But so far everything is working as should will some "Ifs" !
This is how my code looks like atm
is working on a reply...