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

[Solved] Setting menu action

1 Answer 182 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.
Marco Teodoro
Top achievements
Rank 1
Marco Teodoro asked on 21 May 2010, 05:48 PM
Hello, community

this is my code:

            <%=Html.Telerik().Menu()
             .Name("Menu")
             .Orientation(MenuOrientation.Horizontal)
             .BindTo(ServiceLocator.Current.GetInstance<ILoggedOnUser>().UserModels, mapping => mapping
               .For<Modulo>(binding => binding
                  .Children(c => c.ModulosModuloParentList)
                  .ItemDataBound((item, c) =>
                  {
                      item.Text = c.Nome;
                      item.Action(c.Action, c.Controller, null);
                  }))
             )
            %>
I'm trying to set the menu working but i always get this a null exception but the properties that i want to bind are not null

this is the stack trace
   at Telerik.Web.Mvc.Infrastructure.Implementation.AuthorizeAttributeCache.GetAuthorizeAttributes(RequestContext requestContext, String controllerName, String actionName)
   at Telerik.Web.Mvc.Infrastructure.Implementation.ControllerAuthorization.IsAccessibleToUser(RequestContext requestContext, String controllerName, String actionName)
   at Telerik.Web.Mvc.Infrastructure.Implementation.NavigationItemAuthorization.IsAccessibleToUser(RequestContext requestContext, INavigatable navigationItem)
   at Telerik.Web.Mvc.UI.Menu.WriteItem(MenuItem item, IHtmlNode parentTag, IMenuHtmlBuilder builder)
   at Telerik.Web.Mvc.Extensions.EnumerableExtensions.Each[T](IEnumerable`1 instance, Action`1 action)
   at Telerik.Web.Mvc.UI.Menu.WriteHtml(HtmlTextWriter writer)
   at Telerik.Web.Mvc.UI.ViewComponentBase.Render()
   at Telerik.Web.Mvc.UI.ViewComponentBuilderBase`2.Render()
   at Telerik.Web.Mvc.UI.ViewComponentBuilderBase`2.ToString()
   at System.Web.HttpWriter.Write(Object obj)

someone knows how to bind the action.

if i set the url property it works.
But not ActionName and ControllerName properties

hope someone can help

1 Answer, 1 is accepted

Sort by
0
Marco Teodoro
Top achievements
Rank 1
answered on 21 May 2010, 05:58 PM
I found the error...

i was setting an action than does't exist on the solution.

if you someone find this issue make sure you have the respective controller action on code.

best regards
Tags
Menu
Asked by
Marco Teodoro
Top achievements
Rank 1
Answers by
Marco Teodoro
Top achievements
Rank 1
Share this question
or