In the second case that is because SpecialOfferFdr is obtained from DynamicNodeList.Items so it's an IEnumerable<DynamicNode>... and .Take(2) is an extension method of IEnumerable<T>... trouble is, because Model is dynamic, SpecialOfferFdr is dynamic, and extension methods don't run on dynamics. If you do:
IEnumerable<DynamicNode> SpecialOfferFdr = Model.....Items; foreach (dynamic t in sof.Take(2)) { ... }
It should work because then SpecialOfferFdr is not a dynamic but explicitely an IEnumerable<T> and the Take() extension method works.
As for why the first case does not work... can't tell...
Take() not working with DynamicNode
Can someone explain why Take() isnt working here ?
This didnt work either
//fuji
What do you mean by "isn't working"?
Hi Stephen,
Well when i make use of Take(2) here
I dont get any results,.
And if i make use of this
I get an error when rendering the script
In the second case that is because SpecialOfferFdr is obtained from DynamicNodeList.Items so it's an IEnumerable<DynamicNode>... and .Take(2) is an extension method of IEnumerable<T>... trouble is, because Model is dynamic, SpecialOfferFdr is dynamic, and extension methods don't run on dynamics. If you do:
It should work because then SpecialOfferFdr is not a dynamic but explicitely an IEnumerable<T> and the Take() extension method works.
As for why the first case does not work... can't tell...
Yes got working i changed it to
Well tried both and works. Thanks for the tip
is working on a reply...