Action gets assigned to Parent node when Area is set

4 posts, 0 answers
  1. Veeralakshmi
    Veeralakshmi avatar
    2 posts
    Member since:
    Mar 2015

    Posted 13 Apr 2015 Link to this post

    Hi

    I have created Kendo menu using Model binding and set the Area as shown below

     

    @(Html.Kendo().Menu()
    .Name("menu")
    .BindTo(Model,mp=>
    {
    mp.For<MyModel>(binding => binding 
                .ItemDataBound((item, main) =>             {
    item.Text = main.FormName;
    if (main.ActionName != "")
    {
    item.Action(main.ActionName, main.ControllerName, new { area = main.AreaName });
    // item.ActionName = main.ActionName;
    // item.ControllerName = main.ControllerName;
    }
    })
    .Children(main => main.Children));
    })
        
       )

     

    Menus are loaded correctly with 2 levels and the actions are invoked from respective areas correctly. However for the parent node default action is set. Parent node is not assigned any action.

     

    When Area is removed, the parent node does not have action. When setting area, parent node also gets Href

     Warm Regards,

    Veeralakshmi Jeyavelu

     

     

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 15 Apr 2015 Link to this post

    Hello Veeralakshmi,

    The only option for the parent node to have a default Action is if its ControllerName/ActionName is set. Here is a screencast that shows when the parent node renders a href attribute.

    I would suggest you verify that the parent's ActionName indeed is not set. If the problem still persists, please send us a repro demo.

    Regards,
    Georgi Krustev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Veeralakshmi
    Veeralakshmi avatar
    2 posts
    Member since:
    Mar 2015

    Posted 20 Apr 2015 in reply to Georgi Krustev Link to this post

    Hi, Thanks for your reply.

    I checked  you screen cast. I get this problem when binding using asp.net MVC model. As shown in the code snippet

    item.Text = main.FormName;
    if (main.ActionName != "")
    {
    item.Action(main.ActionName, main.ControllerName, new { area = main.AreaName });

    }

     

    For nodes that do not have action in model - only text is assigned. However when using area

    internally sets area as "" and adds href

    When in the same code snippet area is not given, works fine

    Can you please check the problem of binding using a model?

     

    Thanks again

    Warm Regards,

    Veeralakshmi Jeyavelu

     

     

  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 22 Apr 2015 Link to this post

    Hello again Veeralakshmi,

    I modified the test demo to use model binding, but I still cannot observe the erroneous behavior. I attached the demo to this message. Would it be possible to modify it in order to replicate the issue?

    Regards,
    Georgi Krustev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready