This is a migrated thread and some comments may be shown as answers.

[Solved] MissingMethodException when using .Action() on menu items

3 Answers 71 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tom
Top achievements
Rank 1
Tom asked on 11 Jan 2012, 11:09 AM
Hi,

The following menu definition:

@{ Html.Telerik().Menu()
        .Name("Menu")
        .Items(menu =>
        {
             menu.Add()
                .Text("Projects")
                .Items(item =>
                {
                    item.Add().Text("Add").Action("New", "Project");
                });        
        })     
        .Render();
}

..throws a "MissingMethodException":

[MissingMethodException: No parameterless constructor defined for this object.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
   System.Activator.CreateInstance(Type type) +6
   Telerik.Web.Mvc.Infrastructure.Implementation.ControllerContextCache.ControllerContextFactory(RequestContext requestContext, String controllerName, String areaName) +162
   Telerik.Web.Mvc.Infrastructure.Implementation.<>c__DisplayClass1.<GetControllerContext>b__0() +64
   Telerik.Web.Mvc.Infrastructure.Implementation.NoCache.Get(String key, Func`1 defaultValueFactory) +36
   Telerik.Web.Mvc.Infrastructure.Implementation.ControllerContextCache.GetControllerContext(RequestContext requestContext, String controllerName, String areaName) +223
   Telerik.Web.Mvc.Infrastructure.Implementation.AuthorizationContextCache.AuthorizationContextFactory(RequestContext requestContext, String controllerName, String actionName, String areaName) +62
   Telerik.Web.Mvc.Infrastructure.Implementation.<>c__DisplayClass1.<GetAuthorizationContext>b__0() +70
   Telerik.Web.Mvc.Infrastructure.Implementation.NoCache.Get(String key, Func`1 defaultValueFactory) +36
   Telerik.Web.Mvc.Infrastructure.Implementation.AuthorizationContextCache.GetAuthorizationContext(RequestContext requestContext, String controllerName, String actionName, RouteValueDictionary routeValues) +358
   Telerik.Web.Mvc.Infrastructure.Implementation.ControllerAuthorization.IsAccessibleToUser(RequestContext requestContext, String controllerName, String actionName, RouteValueDictionary routeValues) +152
   Telerik.Web.Mvc.Infrastructure.Implementation.NavigationItemAuthorization.IsAccessibleToUser(RequestContext requestContext, INavigatable navigationItem) +290
   Telerik.Web.Mvc.UI.<>c__DisplayClass2`1.<IsAccessible>b__1(T item) +76
   System.Linq.Enumerable.Any(IEnumerable`1 source, Func`2 predicate) +151
   Telerik.Web.Mvc.UI.NavigatableExtensions.IsAccessible(IEnumerable`1 items, INavigationItemAuthorization authorization, ViewContext viewContext) +267
   Telerik.Web.Mvc.UI.NavigationItemContainerExtensions.WriteItem(TItem item, TComponent component, IHtmlNode parentTag, INavigationComponentHtmlBuilder`1 builder) +865
   Telerik.Web.Mvc.UI.<>c__DisplayClass4.<WriteHtml>b__3(MenuItem item) +63
   Telerik.Web.Mvc.Extensions.EnumerableExtensions.Each(IEnumerable`1 instance, Action`1 action) +200
   Telerik.Web.Mvc.UI.Menu.WriteHtml(HtmlTextWriter writer) +430
   Telerik.Web.Mvc.UI.ViewComponentBase.Render() +131
   Telerik.Web.Mvc.UI.ViewComponentBuilderBase`2.Render() +55
   ASP._Page_Views_Shared_MenuItems_cshtml.Execute() in ...MenuItems.cshtml:1
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +207
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +220
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
   System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +279
   System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper htmlHelper, String partialViewName) +71
   ASP._Page_Views_Shared__Layout_cshtml.Execute() in ..._Layout.cshtml:25
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +207
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
   System.Web.WebPages.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer) +102
   System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +12
   System.Web.WebPages.WebPageBase.Write(HelperResult result) +67
   System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +66
   System.Web.WebPages.WebPageBase.PopContext() +262
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +95
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +220
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +303
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +23
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
   System.Web.Mvc.Controller.ExecuteCore() +116
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8897857
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

..whereas using the following syntax produces no error:

@{ Html.Telerik().Menu()
        .Name("Menu")
        .Items(menu =>
        {
             menu.Add()
                .Text("Projects")
                .Items(item =>
                {
                    item.Add().Text("Add").Url(Url.Action("New", "Project"));
                });       
        })    
        .Render();
}

I am using Telerik version 2011.3.1306.340 and runtime verison v4.0.30319.

Is there a reason why .Action() no longer works directly on menu items?

Thanks,
Tom.

3 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 11 Jan 2012, 11:55 AM
Hello,

This is a known issue, which is already fixed. I will suggest you check this thread and download the latest internal build.


Kind regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Srinivas Dharanipragada
Top achievements
Rank 1
answered on 11 Oct 2012, 02:23 PM
I am already using latest version, even though Action is not working, can you please give me the snippet for using it.
0
Georgi Krustev
Telerik team
answered on 12 Oct 2012, 03:50 PM
Hello Srinivas,

 
I am not sure why your project does not work with the latest version of Telerik Extensions for ASP.NET MVC. I will need a runnable test project, which replicates the issue in order to review it and advice you further.

All the best,
Georgi Krustev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
Menu
Asked by
Tom
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Srinivas Dharanipragada
Top achievements
Rank 1
Share this question
or