Hello guys! I'm kinda new to Umbraco, and here also, but i'm following a tutorial to make a begginers website, and I followed every step along the way. But unfortunatly, the video i'm seeing doesn't has this error, and I do.
List<NavigationList> navList = null;
var subPages = page.Children.Where("Visible");
The error that appears is " 'object' does not contain a definition for 'Where' ".
The previous error dissapeared, but now i'm getting "Value cannot be null Parameter name: Collection", my code is as follows (as the video teaches me)
public List<NavigationList> GetNavigationModel()
{
int pageId = int.Parse(CurrentPage.Path.Split(',')[1]);
IPublishedContent pageInfo = Umbraco.Content(pageId);
var nav = new List<NavigationList>
{
new NavigationList (new NavigationLinkInfo(pageInfo.Url,pageInfo.Name))
};
nav.AddRange(GetSubNavigationList(pageInfo));
return nav;
}
That might be because there are no items in the navigation,
On your GetSubNavigationList method i would change
List<NavigationList> navList = null;
to
List<NavigationList> navList = new List<NavigationList>();
this will mean the list is always something even if it's empty. and that will stop the next bit throwing an error when there are no pages to put in the list.
I've had a google, i think the main problem is the video you are looking at was for Umbraco 6/7 and in Umbraco 8 you can't do 'dynamics' anymore :( so anywhere where 'dynamic' is used the code is going to need to be re-written
Problems with object and definition of Where
Hello guys! I'm kinda new to Umbraco, and here also, but i'm following a tutorial to make a begginers website, and I followed every step along the way. But unfortunatly, the video i'm seeing doesn't has this error, and I do.
The error that appears is " 'object' does not contain a definition for 'Where' ".
Is there a way to fix it?
PS: It's for a dynamic Header with the pages
Hi,
Try using this Page.Children.Where(x => x.IsVisible)
-Joep
It didn't work, same error :(
Hi,
Sorry it is IsVisible() forgot that it was a method.
-Joep
For what i've read, it is a problem on "using System.Linq" but i do have that on my project, just says it's unnecessary dont know why
Hi,
I think you are following the same video as in this post.: https://our.umbraco.com/forum/using-umbraco-and-getting-started/101110-code-error
Its quite a long thread but the basics are in this reply: https://our.umbraco.com/forum/using-umbraco-and-getting-started/101110-code-error#comment-317042
Hi Kevin,
The previous error dissapeared, but now i'm getting "Value cannot be null Parameter name: Collection", my code is as follows (as the video teaches me)
The error says it's in the line that has:
Hi
That might be because there are no items in the navigation,
On your GetSubNavigationList method i would change
to
this will mean the list is always something even if it's empty. and that will stop the next bit throwing an error when there are no pages to put in the list.
I've had a google, i think the main problem is the video you are looking at was for Umbraco 6/7 and in Umbraco 8 you can't do 'dynamics' anymore :( so anywhere where 'dynamic' is used the code is going to need to be re-written
Is there any begginers tutorial for 8 then? because not knowing how to do things, is hard :/
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.