I am even getting all the relations, and the selection of the four random is being done after this call. So in the array, I am also getting all relations, even the uncessary.
May I choose the four random in this line of code where I am getting the relations?
Get a random number of relations
Hi Guys,
Does anybody knows how I can achieve this:
I have this line of code, where I getting all relations that a country has with a category:
Now, I need not to get all relations , but only 4 random.
Does anybody know how I can dot his please?
Thank you.
Hi you can use the linq functionality to fetch random from the list.
e.g
So in your case
Hope it helps.
LUV umbraco!
Hi jigar,
Thank you for your reply.
But with the first line of code,
I am even getting all the relations, and the selection of the four random is being done after this call. So in the array, I am also getting all relations, even the uncessary.
May I choose the four random in this line of code where I am getting the relations?
Thank you.
Kind Regards.
yes you can product the one liner for sure, I was trying to give the quick direction.
It should look like
Hope it help.
Luv Umbraco!!!
Can you guide how I can achieve it please?
Oops Jigar, I did not see the full comment .
Thank you. I will try it :)
Cheers
did that worked for you?
Works Fine :)
Cheers
is working on a reply...