This project is read-only.

Advanced Menu cannot Add/Edit

Topics: General, Troubleshooting
May 15, 2012 at 3:28 PM
Edited May 18, 2012 at 10:34 AM

update May 18: consider it closed - read last msg !

Dashboard -> 'Manage Main Menu': whenever I try to 'Edit' or '+Add Item' I get below error. Although, I'm able to 'Delete' a menu Item!

I tried to resolve by:
- deleting the 3  Migration records in .sdf
- deleting all szmyd. data records in .sdf 
- then deleted  Module 'Szmyd.Orchard.Modules.Menu' and reloded the 1.4.1 version from the 'Gallery' - NO change.
Whether I'm in Orchard 1.4 or 1.4.1 doesn't make any difference either!

PS: the Migration and the data records got created correctly again! But I cannot '+add items'!
BUT: then I copied the  'App_Data' folder from my saved project and all is ok for the 'end-user' .... but still no editing of the Menu i.e. same error see below!

 Any help is appreciated - something must have changed - I don't have any clue!
Thanks for your time

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 15:         <div><i>or</i></div>
Line 16:         @Html.LabelFor(m => m.ChosenItemId, @T("Choose content item"))
Line 17:         @Html.DropDownListFor(m => m.ChosenItemId, Model.AvailableItems)
Line 18:         @Html.ValidationMessageFor(m => m.ChosenItemId, "*")
Line 19:         <span class="hint">

Source File: d:\CMSites\MySite\Modules\Szmyd.Orchard.Modules.Menu\Views\EditorTemplates\Parts\Menu.AdvancedItem.cshtml    Line: 17

May 16, 2012 at 6:56 AM

The info above has been taken using WebMatrix. Now I tested the same in VS2010 and get some more info but , I guess, it's the same error.

in 'AdvancedMenuItemPartDriver.cs' I get

error: 'Object reference not set to an instance of an object.' (the bolded  code, starting line 53, is highlighted at time of error)

part.AvailableItems = new SelectList(new[] { new SelectListItem { Text = T("(None)").Text, Value = default(int).ToString(CultureInfo.InvariantCulture) } }
                .Concat(routables.OrderBy(x => x.ContentItem.ContentType).ThenBy(x => x.Id).Select(x => new SelectListItem
                    Value = x.Id.ToString(CultureInfo.InvariantCulture),
                    Text = string.Format("{1}:\t{0}", x.As<TitlePart>().Title, x.ContentItem.TypeDefinition.DisplayName),
                    Selected = x.Id == part.RelatedItemId
                })), "Value", "Text", part.RelatedItemId.ToString(CultureInfo.InvariantCulture));

... what have I done wrong

thanks for your time, ed

May 18, 2012 at 10:32 AM

my apologies in case you spent time reading it!

after some long nights I realise that one of my own Module is obviously interfering with with the 'Advanced Menu'! Removing my Module brings all back to order!

well, still a lot to learn , ed