First of all, great package! I'm experiencing some problems with the search page if you could help that'd great.
Basically, whenever I navigate to the search page I get the YSOD -
Object reference not set to an instance of an object.
Line 11: {
Line 12: <ul>
Line 13: @foreach (var node in parent.Children.Where(x => x.IsVisible() && !x.IsDocumentType("NewsArticle"))) Line 14: {
Line 15: var selected = Array.IndexOf(Model.Path.Split(','), node.Id.ToString()) >= 0 ? " class=\"selected\"" : "";
I have not made any modification to the code, just wondering if there's something that I missed.
I just republished the whole site the now. However, it didn't get rid of the problem. I noticed that there isn't a search 'page' in the 'Content' area, only the search.cshtml in the 'Templates' section. Do you think that's the cause?
Fixed! I created a 'search' page in the 'Content' section, and the problem went away. I think Umbraco was confused with the 'Model' when there wasn't an actual page.
Does this mean that you can no longer use the template alias as a page?
i.e. before just having a template named search would trigger that to be used for the search.
** Just to update - this still works for templates & altTemplates so how come it doesnt work for the search/code in a template? Just asking to get my head around this part of umbraco the MVC stuff.
Can't get the search results to work
If you can't get the search results to work then try
Hi Chris,
First of all, great package! I'm experiencing some problems with the search page if you could help that'd great.
Basically, whenever I navigate to the search page I get the YSOD -
Object reference not set to an instance of an object.
Line 11: { Line 12: <ul> Line 13: @foreach (var node in parent.Children.Where(x => x.IsVisible() && !x.IsDocumentType("NewsArticle"))) Line 14: { Line 15: var selected = Array.IndexOf(Model.Path.Split(','), node.Id.ToString()) >= 0 ? " class=\"selected\"" : "";
I have not made any modification to the code, just wondering if there's something that I missed.
Thanks in advance!
Chen
Hi Chen,
Looks like it may be a problem with the publishing of the pages. Can you try republishing all pages?
Failing that can you let me know the exact line that's throwing the error.
Cheers,
Chris
Hi Chris,
I just republished the whole site the now. However, it didn't get rid of the problem. I noticed that there isn't a search 'page' in the 'Content' area, only the search.cshtml in the 'Templates' section. Do you think that's the cause?
Thanks!
Chen
Yep, you should have a content page called Search. This is a a Standard doctype with the template set to 'Search'.
Fixed! I created a 'search' page in the 'Content' section, and the problem went away. I think Umbraco was confused with the 'Model' when there wasn't an actual page.
Thanks for your replies Chris.
Chen
Does this mean that you can no longer use the template alias as a page?
i.e. before just having a template named search would trigger that to be used for the search.
** Just to update - this still works for templates & altTemplates so how come it doesnt work for the search/code in a template? Just asking to get my head around this part of umbraco the MVC stuff.
is working on a reply...