I am using the Auros categorisation package and I am having issues with some functionality that uses the .SKIP method. Namely, the following piece of code
var pagesToList = NodeHelpers.GetNodesInCategory("Testimonial",Convert.ToInt32(Request["c"],0));var numberOfItems = pagesToList.Count(); currentPage--; var numberOfPages = numberOfItems % itemsPerPage == 0 ? Math.Ceiling((decimal)(numberOfItems / itemsPerPage)) : Math.Ceiling((decimal)(numberOfItems / itemsPerPage))+1; var Pages = Enumerable.Range(1, (int)numberOfPages);
@foreach(var item in pagesToList.Skip(currentPage*itemsPerPage).Take(itemsPerPage)) { }
Is giving me the following error message: error CS1973: 'umbraco.NodeFactory.Node[]' has no applicable method
named 'Skip' but appears to have an extension method by that name.
Extension methods cannot be dynamically dispatched. Consider casting the
dynamic arguments or calling the extension method without the extension
method syntax.
I just can't work out how to cast the pagesToList variable so that the .Skip functionality will work, which is being used for paging purposes. Does anyone have any idea as to how I can accomplish this?
Perfect, thank you very much, that was indeed the issue and changing from "var" to "int" solved the problem straight away. I will keep that in mind for the future!!
Problem with .Skip functionality
I am using the Auros categorisation package and I am having issues with some functionality that uses the .SKIP method. Namely, the following piece of code
Is giving me the following error message: error CS1973: 'umbraco.NodeFactory.Node[]' has no applicable method named 'Skip' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.
I just can't work out how to cast the pagesToList variable so that the .Skip functionality will work, which is being used for paging purposes. Does anyone have any idea as to how I can accomplish this?
Maybe i'm wrong but i think that it's not because of the pagesToList variable. It's because of the parameters you gave to the Skip() method.
Both variables are of type dynamic. Try to use "int" instead. Maybe that helps.
Perfect, thank you very much, that was indeed the issue and changing from "var" to "int" solved the problem straight away. I will keep that in mind for the future!!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.